Remote host identification has changed

April 04, 2018

server connection
linux
ssh

When you try to connect to a remote server via ssh and you receive the following message:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:shacode.
Please contact your system administrator.
Add correct host key in /Users/username/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/username/.ssh/known_hosts:21
RSA host key for IP_ADDRESS has changed and you have requested strict checking.
Host key verification failed.

you can reset the known_host for the IP_ADDRESS using the command:

ssh-keygen -R <hostname or ip_address>

the -R hostname removes all keys belonging to hostname from the known_hosts file.


Written by huckbit web developer who lives and works in UK building cool things. You can find me on twitter.