Revision of Fix the SSH “Remote Host Identification Has Changed” Error from Tue, 01/29/2008 - 22:30

Every SSH server uses a random key to identify itself. When SSH is installed a new key is generated. SSH clients keep track of the host key, if it changes the user can be warned that they might not be connecting to the computer they think they are. Most of the time this happens when the SSH server or the OS are reinstalled.

In the case of the SSH client in Linux, a changed host key results in the client refusing to connect and showing an remote host identification has changed error.

The easiest way to fix the problem is to delete the known_hosts file:
rm ~/.ssh/known_hosts

This causes the SSH client to forget all the host keys it knows about. Next time you connect, it will create the file again and ask you before adding the new key.

The version of SSH installed in Ubuntu does not produce a known_hosts file that is easily readable. Unless you are paranoid about security, simply deleting it is safe.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

NOT the right way...

I'm sorry, that is maybe the easiest way, but certainly not the safest way.

The safest way is to check whether the destination host has indeed changed their ssh keys and then edit the .ssh/known_hosts file and delete the corresponding entry in that file, not the whole file.

Thanks for the

Thanks for the clarification!