Remove offending ssh key

I had renamed a few boxes recently and when I tried to login into one today I got the 

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa.
Please contact your system administrator.
Add correct host key in /.ssh/known_hosts to get rid of this message.
Offending key in /.ssh/known_hosts: 339
Permission denied (publickey,password).

This is a nice and simple fix, on your server you are connecting from, a simple sed one liner, cd into your .ssh directory and type 

sed -i '339d' known_hosts

You will just have to change it for your corresponding line that is displaying

I am always interested in feedback so please feel free to add any comments, or you can mail me  here.  If you would like to submit a quick tip  with full credit and links back to your site then also feel free to contact me.

Related Posts Plugin for WordPress, Blogger...

Combine columns from two text files into one

Remove Spaces from a text file