I've just tried to SSH in to a server that I've been doing so without problems for a while, and received a warning that the server's host key has changed.
But it hasn't!
On the server, I've checked the hosts key which is being referenced in /etc/ssh/sshd_config
, and it has not changed.
On the client, I checked the known_hosts
file, and the existing entry in there has the correct public key. I tried moving the known_hosts file away temporarily, and set StrictHostKeyChecking
to no
in /etc/ssh/ssh_config
so that it would automatically connect so I could compare the public key. When I did this, and checked the new entry in known_hosts
, the public key part is identical to before!
So why wouldn't it connect? The only thing that is different in known_hosts
is the salt and hash of the hostname. But since I am, and always have, connected via the IP and port, without using the hostname, these must surely be correct.
Any ideas?
Note that all clients attempting to connect that have previously connected are getting this message. So it's not a problem with the client.
EDIT: I should add that when I connected with StrictHostKeyChecking
set to no
and it created a new known_hosts
file, when I then tried connecting again using the new known_hosts
file and StrictHostKeyChecking
back to yes
, it connected without warning. In other words, the new known_hosts
file worked without warning, whereas the old one did not, despite having the same public key inside.