Get rid of SSH error message “WARNING REMOTE HOST IDENTIFICATION HAS CHANGED”

by | Jan 7, 2015 | Linux, RHEL / CentOS

In Linux when you try to SSH it may at times give you this warning that REMOTE HOST IDENTIFICATION HAS CHANGED. It usually happens when the hostname or IP has changed of a host or the host was rebooted and generated a new fingerprint Key ID. No need to worry, it can be removed by a single command and you would be up and running in no time.

Warning 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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
7b:c3:5c:22:96:03:7b:e8:6d:98:87:5b:28:1d:4c:08.
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending key in /home/user/.ssh/known_hosts:2

Run this command to delete the offending key in .ssh/known_hosts

# sed -i '3d' ~/.ssh/known_hosts

*Replacing “3d” with the number of offending key.

In the above example see “line 11”

# sed -i '2d' ~/.ssh/known_hosts

If you encounter any errors during the process, let us know via Contact Us and will get it resolved promptly.

Related Articles….