Wednesday, July 8, 2009

remove host key from .ssh/known_hosts

$ ssh user@192.168.1.78

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
fd:1f:3d:fb:2e:ad:f4:f4:35:2e:03:f4:xx:xx:xx:xx.
Please contact your system administrator.
Add correct host key in /xxxx/xxxx/.ssh/known_hosts to get rid of this message.
Offending key in /xxxx/xxxx/.ssh/known_hosts:4
RSA host key for 192.168.1.78 has changed and you have requested strict checking.
Host key verification failed.
lost connection

When you get this kind of error in your system, it means that either server's RSA host key has been changed or your local machine host key is changed. Don't try to delete the .ssh folder instead, use the below command to fix this issue only for a particular host.

$ ssh-keygen -R 192.168.1.78

This will help in changing only one host's key to be removed. And now when you do it again it will ask for you to add the host key in your local machine.

No comments:

Post a Comment