How to fix: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
5c:fb:f7:1c:33:e1:cf:ac:a7:ab:42:59:d3:7c:57:d2.
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:9
RSA host key for xx.xx.xx.xx has changed and you have requested strict checking.
Host key verification failed.

One reason for this to happen can be that you changed the machine, although it has the same IP address. It happened to me with DigitalOcean.

Solution: Regenerate the key

ssh-keygen -R xx.xx.xx.xx

(note that username and ip address have been replaced by dummy values)

Advertisements

One thought on “How to fix: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

  1. developerPearson says:

    Or you can remove the known_hosts file in .ssh.
    On terminal:
    rm /home/yourname/.ssh/known_hosts
    When you ssh to the server, you should be able to add the remote key to the known_hosts again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s