Wednesday, January 11, 2012

Host Key Verification Failed in SSH



When I was trying to connect to a remote host through a server, I faced this key verification failure. This can be happened due to different reasons.
1. The remote server has re-installed the SSH server.
2. Remote server has generated a new host key.

 In my case I could able to fix this as follows and think this will helpful for someone else as well.


Error : \@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
17:c7:8f:e7:6b:09:87:9b:13:65:ac:2c:76:47:a8:69.
Please contact your system administrator.
Add correct host key in /home/madhura/.ssh/known_hosts to get rid of this message.
Offending key in /home/madhura/.ssh/known_hosts:17
RSA host key for 10.40.18.160 has changed and you have requested strict checking.
Host key verification failed.

Solution : 
Normally, our host keys are saved in "~/ssh/known_hosts”. 
1. Open this file and remove the line which is notifying the specific remote host key that you are getting trouble.

  •   Here it's good to turn on the Line Numbers in your text editor. Then it's easy to figure out which part to remove.
If you don't know how to remove that specific host key, then you need to,
2. Remove your known_hosts file. 
  • But then you lost your other remote host keys as well. However your SSH-Client will create a new "~/ssh/known_hosts” 
If you are prompting a warning that saying authenticity can't established and asking to continue, type "yes" and enter. 

Cheers...

No comments:

Post a Comment