Solve remote host identification has changed issue.

How to solve “remote host identification has changed”?

Posted by

Connecting to a remote server through command line or tools that use SSH can be a pain in the brain sometimes. We understand the situation when everything seems perfect but does not function properly. Here is the error you might be facing right now.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
3d:1b:02:9e:b2:b8:f0:f7:c6:4f:94:96:f6:e3:c0:d1.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:8
RSA host key for HOST has changed and you have requested strict checking.Host key verification failed.

In this short and sweet article, we will discuss everything about this warning including the major causes, why this warning is shown and how to solve this issue for now and in future too!

First of all, let us understand why this error is caused. Every server with SSH maintains it’s own unique identity that is unique and is validated every time on a remote server as well as the local server.

So, what is the primary cause of the Remote host identification has changed warning? The warning can be generated by many reasons but 99% of the times, Operating system is re-installed on the remote server that will change its identity, and your local server has an old identity of your remote server. There might be some other causes too! Like remote server’s Host key has been updated.

We can clearly see the issue here. Let’s make it easier to understand, For instance, the identity of our remote server is IAMREMOTESERVER1101 that our local server knows. But when we re-install Operating system on the remote server, host key will be updated too which will change the identity of the remote server. Let’s assume that its new identity is IAMREMOTESERVER1011 that our local server does not know.

So, when we try to connect with the same host with different identity information, our local server will warn us that we are not connecting to the server we are supposed to. In that way, remote host identification has changed warning is saving us from trouble.

The simplest solution to get rid of this warning is to remove the old identity of the remote server so that we can store the new identity of the remote server. And that’s what we are going to do.

Solved: remote host identification has changed

To solve the issue, Just execute the following command on your local server or client-server.

user@locahost:~$ ssh-keygen -R REMOTE_HOST

This command will find the old remote host identity and will remove it from the known_hosts file. Once the old identity is removed, you can try connecting with a server again, and it will ask you yes/no question just like it asks for the first time when you connect with the remote server.

Just type Yes and hit Enter. It will store the new identity of the server in a known_hosts file, and you will never face the issue again until you re-install Operating system or update Host key on the remote server.

So, this is how you can get rid of the remote host identification has changed error. This warning is designed to save us from man-in-the-middle attack but sometimes it may create issues connecting to the right server is Host key is changed. If you are still facing this issue, comment dow and we will respond as soon as possible.

Leave a Reply

Your email address will not be published. Required fields are marked *