Thursday, April 29, 2010

Linux SSH Error - Remote host identification changed

Hi all,
when I try to connect to my remote host through ssh, it throws an error called Remote host identification is changed, below is the process for how can we get rid of this message.

The possible reasons for getting this error are:
If os and openssh in your system is reinstalled, or os or openssh is reinstalled in remote system.
You have assigned the IP address of one system to another system and trying to ssh.
You system is dual boot with different ssh keys in both flavors of linux.
You are using an IP for load balancing and trying to ssh to the same IP.
You generated new ssh keys for your system.

When you tries to login to a remote system through ssh, then the destination hosts provides it’s keys and asked whether these keys are trusted and then those keys are added to your trusted database(known_hosts file). Whenever you tries to login again to the same system, the received keys are checked against the keys available in your file and if both matches then the next step occurs, which is authentication. But if due to any of the above given reason, the keys doesn’t match, then you will get this error and won’t be able to login.

The solution for this problem is
Just remove the old key for remote host from your system's known_hosts file, So when you try to connect through ssh it will again ask you to store the key in the known_hosts file.
OR
Completely Remove keys from known_hosts file
To remove the old keys from the known_hosts file, we can use -R option. This option will remove all the obsolete/old keys from your file. This can be used like this:
# ssh-keygen -R
# ssh-keygen -R

The path for known_hosts file is
In linux
home/venkat(username)/.ssh folder
In windows
c:/documentes and settings/venkat

No comments: