Regain access to EC2 instance, after a botched sshd_config.

I just made a big mistake. Made a change to the sshd_config on a production server that locked me out. My heart skipped a beat when I lost connection and was presented with

brandons_mbp:~ bleon$ ssh domain

ssh: connect to host domain port 22: Connection refused

This is on one of my clients web servers. But I was able to revert the changes. It was a little complicated but it worked.

I knew the exact lines that needed to be removed just getting to them without connecting to the server was the trick. This is why running on EC2 saved me. I stopped the running instance for the web server and disconnected the volume from the instance.

I fired up a temporary CentOS instance (any *nix instance should work, CentOS just happens to be my favorite) and attached the volume to the new instance as a secondary disk. This allowed me to SSH into the new instance and browse the filesystem of the server I locked myself out of. Now using vi or your favorite editor edit the sshd_config file, shutdown the server, disconnect the volume and re attache it to your web-server instance.

I started the webserver instance and crossed my fingers, and when I tried to SSH in again I was successfull.

It would also be a good idea to create a snapshot of your volume before attempting any of this to be safe. And to test any changes your going to make that could potentially lock you out on a system you have physical access to.

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

16YU8gK5RPJNQdVeyAvEwWg6ec8pZhusuV

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Nagios check_http

Just a quick and dirty post regarding the Nagios check_http plugin. found a little quirk that kept me scratching my head for some time. I added a new site to my monitoring system and ended up getting a result of

HTTP OK – HTTP/1.1 302 Moved Temporarily – 0.174 second response time |time=0.17

turned out the web hosting provider was redirecting you to the actual content but the check_http plugin does not follow the redirect by default. I corrected the issue by adding “-f follow” switch to the command. This tells the check_http plugin to follow any redirects it encounters.

HTTP OK HTTP/1.1 200 OK – 1.010 second response time |time=1.009625s;;;0.000000 size=12304B;;;0

so your entire command should look like the following:

define service{
use remote-service
host_name [hostname]
service_description HTTP
check_command check_http!-H [domanname] -f follow -s “[String to look for]”
}

The final -s switch is optional but it will help notify you of any unauthorized changes made to the site your monitoring (eg. Hacking attempt).

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

1JEzeQVoWMjXjtaWQRcyDnDzqLA6NYfSRQ

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Linux Mint

Linux Mint

So I’ve always been a fan of Ubuntu, yea yea I know what your saying already, but Ubuntu is for people that don’t know anything about Linux. We’ll your right and thats party why I like it because its designed in that manner, It installs super fast, I can have a Ubuntu server up and running AND hosting a web page in under 10 min, and its stable.

I have a few Ubuntu servers I manage that have upwards of 150+ days of uptime and they are still running great. Ok now I hear all the Linux guys out there complaining that Ubuntu systems are so hard to Troubleshoot and Diagnose. Right again, but who cares, remember I can have a Ubuntu system up and running in under 10 min if its a simple Web or Database server, so if I determine I’m going to have more then 10 minutes of troubleshooting time to fix my issue, I reinstall the system and restore backups. My linux boxes do daily backups, if your running a more mission critical Database server you may want to run Hourly backups, in my case its only a simple internal Wiki.

MintDesktop

Okay, enough server talk, lets talk desktops, I’m usually a Mac guy but I have an extra box at work thats my own personal Linux box, I talked my Manager into letting me bring it in because the Linux network diagnostic tools are wonderful, It used to be a Ubuntu system but when the Primary hard disk failed I opted to give Linux Mint a shot.

Initial impressions were wonderful the Installation process was very straight forward and I’m confident any computer user would be able to figure it out, with the exception being the partition management, but then again partition management on any Unix system is fairly hard to wrap your head around for anyone coming from a windows environment. This is largely due to the fact that Unix does away with each disk getting its own filesystem (kinda). On a unix system there is the root filesystem which is mounted on a disk but you can then mount others disks into directories on that filesystem, so while each disk still gets its own filesystem its all transparent to the end user.

A common way to set up your system is to install the os to a small but quick disk then mount a big beefy disk to the /home folder of the partition this allows the system files to load very fast and at the same time allows you to separate tee users home folders. another advantage to this setup is if you ever have a problem with the system you can wipe the main disk reinstall the system then simply remount the disk with the home files back to the new /home folder, instant restore of users files.

This is actually the setup I was running under ubuntu until the primary hard disk failed, then I ditched it and installed the new system to a single disk, eventually I’ll go get a second disk for it an copy the home files over to the new disk and mount it over the systems /home folder.

MintPackage

Package management is super easy in mint, when you see the little green check mark on the lock in the task bar go away you know your system needs an update, click it enter your password and the system automatically downloads and installs all relevant updates. And since Mint is based off Ubuntu any applications designed for Ubuntu should also run on Mint with little or no extra configuration.

if you have an extra machine laying around give Linux Mint a shot Im glad I did you just may decide you like linux =)

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

16aJ4waRF92iPQXqhkxGrFGUDtjJ2XwtBD

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Mac’s Vs PC’s

I’ve tried to stay out of the whole Mac Vs. PC argument.

Which actually is no longer the Mac Vs. PC argument. Mac’s are now Intel based, so they are PC’s.

So it’s now the Mac’s Vs. Windows Argument.

I’ve still tried to keep my head out of it because I don’t think one’s better than the other, both serve their purpose. Windows just serves a purpose that does not suit me anymore, so I stay away from it except for at work. (OK, that’s only half true. I  do quite a bit of work on my Linux box even at work. I love the network diagnostic abilities resident in Linux).

A perfect example.Want to play games on your computer? Don’t bother with a Mac. I don’t really play to0 many games on my computers anymore, and the few I do play all actually have Mac clients, so I’m good. But Windows currently holds the edge in the gaming market, way above Apple.

Anyway, let’s get down to the point. I recently got a comment on my MySpace profile (yea yea I know Myspace, Ewww. but If I want to communicate with my friends up north that refuse to use any other communications means other than MySpace, so I’m stuck). He writes:

“so you finally did it! you went to the dark side and went full on mac?! well since i now know someone that knows computers, can you tell me this? what makes mac’s better than pc?”

And My responce:

“I don’t play the Mac’s are better than PC’s game, they both have their purpose. For you since you play games you’re better off with a PC. I like Macs better because they are full on 64 bit (processor and OS), granted you very well may have a 64 bit CPU but until you get a 64 bit OS it’s useless (of course this is not PC’s fault this is Windows failing to keep up with hardware, you can always run Linux and you’re set.) Yes I know windows has a 64 bit version but hardly any applications are actually compatible with it.

Second reason, Mac software is reasonably priced.

How many Vista versions are there? 6 versions.

How many Versions of Mac OS X? One it does it all. How much? $129.

The best part? My step-dad has an iMac and a MacBook, my sister has a iMac and a Macbook, and my Mom has a iMac. Thats 5 Macs in my parents house.

Let’s see, doing a quick search on Amazon, I see I can get Windows Vista Home Premium for a Mere $117.99. Oh dang. we need 5 copies. That comes out to $589.95 for the basic version of Vista. Ultimate? Yea, that’s going to cost you $1199.95

How much for the OS X Ultimate? Oh wait, that’s right, only one version of OS X, 649.95? Nope, go grab the family pack for $199 and you’re all set.

Got 4 gigs of ram like I do in my Mac? Oh wait,  you can’t use it all because the 32 bit version of Windows doesn’t know how. Got the 64 bit version? Sweet. Oh dang, now you can’t install anything because its not compatible.

I just got tired of dealing with it all. My Mac just works, all the time, whenever I want it to, it works and works well. Am I saying its better than PC’s? No I can’t even say that since everything after OS X is Intel based which means Mac’s ARE PC’s. I can even load Windows on it if I need to, but why load an OS on my Mac that can’t even utilize the hardware to its potential? The only game I currently play on the computer is EVE Online and it has a Mac client. Oh yea, ditto on World of Warcraft, Mac client works fine.

I actually have an AMD Athlon 64 Dual Core 4600+ box laying around that had windows on it but I don’t game enough on the PC platform anymore to need it. And I got sick of Windows so it’s now running Ubuntu Linux.

No more blue screen of death and I don’t have to reformat and reload every 6 months (or more often if I’m lucky).

So, Am I saying My Mac is better than your PC? Nope But I sure prefer it. =)”

Any other thoughts?

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

16VBbhgfWmanPnvnZ2hgGrAzzkDdnyiqLk

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

HP Mini 1000 Ultra-Portable

Check out the HP Mini 1000, this little gadget, (you all know I love gadgets) its HP’s new mobile device, weighing in at only 2.3 lbs its light enough to take anywhere. even as small as it is they keyboard is still 9/10 the size of a standard keyboard.

When it comes to prcessing power it sports a Intel Atom processor ans is available with 1GB of ram (windows version) or 2gigs (Linux version). the Linux version is built on Ubuntu, HP Mini 2000

I actually have a few Ubuntu boxes myself and rather enjoy the OS, I’ve always been a linux fan but Ubuntu is so easy I think pretty much anyone can pick it up and be using it within a few minutes. If your looking for a new Ultra-portable computing solution, check this little guy out.

 

HP Mini 1000 Notebook, Intel Atom Processor N270 1.60GHz, 10.2

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

1Dtq9pg5rJVE3Si7Gu4dt19XXpFfczxxer

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.