When trying to ssh into another box, I get the following message:

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

Please contact your system administrator.
Add correct host key in .ssh/known_hosts to get rid of this message.
Offending key in .ssh/known_hosts:4
RSA host key for _ has changed and you have requested strict checking.
Host key verification failed.

My known_hosts file includes the box I am trying to ssh into but it only works for the other boxes in that file. I did read this question but the solution did not work for me as both boxes are on the same IP address.

  • "...another box... the other boxes ... both boxes ..." Your situation would be clearer if you could edit the post to identify which boxes you are talking about in each spot. Anonymous names like "Host A" "Host B" "Host C" work fine, but ambiguous "boxes" not so much. Aug 13 '16 at 12:23

Easy way is to remove line number 4 (as mentioned in the suggestion - .ssh/known_hosts:4) from the known_host file and re-try.


Normally each computer has its own distinct IP-address. There are a few cases where this is not true:

  • if the computers are configured with DHCP, it is possible for one machine to reuse an IP-address made available from another which lost its lease, e.g., by turning it off for a while
  • less often, someone decides to reuse the same IP-address for more than one machine. That may be due to firewall limitations, to a decision to reuse the address for deploying identical machines, etc.

For the DHCP case, there's no alternative other than by deleting obsolete entries in ~/.ssh/known_hosts. That is the whole point of ssh remote host identification has changed

On the other hand, deliberately reusing IP-addresses can be cumbersome and less secure if one simply removes "incorrect" keys from the known_hosts file. If the machines really are "identical" (and do not run concurrently), then you can reuse the ssh server keys on multiple machines.

For example, in /etc/ssh/sshd_config on one machine, I have

HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key

Those files (and their public counterparts, suffixed with ".pub") could be copied to one of the "identical" servers, and sshd restarted. After that, both copies of the machine would act as the same machine.

On the other hand, if you don't have to setup a reduced-resource configuration, using a different IP-address for each machine is more straightforward.

Further reading:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy