REMOTE HOST IDENTIFICATION HAS CHANGED warning when you try to connect to a server with ssh

If you work in the AWS environment and  launch and terminate servers frequently the same IP is reused many times. When you try to connect to a new server with SSH and the IP address is already in the known_hosts file you will get the following error 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 ECDSA key sent by the remote host is
SHA256:...
Please contact your system administrator.
Add correct host key in /c/Users/.../.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/.../.ssh/known_hosts:13
ECDSA host key for ... has changed and you have requested strict checking.
Host key verification failed.

The solution is to delete the line from the “c:/Users/YOUR_USER_NAME/.ssh/known_hosts” file that has the same IP address as the new server.

Leave a Reply