WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!


Hello ,

Very simple yet common error we get while doing ssh to remote machine :

Reason :
  • Every SSH server uses a random key to identify itself
  • When ssh installed then new key is generated .
  • In this case host key is changed which result in client not able to connect with server , and this message is shown on client side.


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 DSA host key has just been changed.
The fingerprint for the DSA key sent by the remote host is
cc:35:09:ab:86:4b:72:f0:cc:4b:92:92:77:8e:7e:b2.
Please contact your system administrator.
Add correct host key in /home/username/.ssh/known_hosts to get rid of this message.
Offending key in /home/username/.ssh/known_hosts:7
DSA host key for 'servername' has changed and you have requested strict checking.
Host key verification failed.

How to get rid of this ?
  1.  Easiest way is to delete known_hosts file , with " rm ~/.ssh/known_hosts  " So next time when you connect same server it will create this file again and ask you  (Not Recommended)
  2. Preferred way is to use command " ssh-keygen -R server_host_name " , "-R" removes all keys belonging to server_host_name from know_hosts file ( ~/.ssh/known_hosts). (Recommended)
  3. Or you can manually delete keys from ~/.ssh/known_hosts by deleting 7th line in our example.

Best Regards,
Girish...

0 comments:

Post a Comment