SSH connection problem with "Host key verification failed..." error
Solution 1:
"Host key verification failed" means that the host key of the remote host was changed.
SSH stores the host keys of the remote hosts in ~/.ssh/known_hosts
. You can either edit that text file manually and remove the old key (you can see the line number in the error message), or use
ssh-keygen -R hostname
From man page:
-R hostname
Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts .
(which I learned from the answer to Is it possible to remove a particular host key from SSH's known_hosts file?).
Solution 2:
If you are running in certain remote/scripting situations where you lack interactive access to the prompt-to-add-hostkey, work around it like this:
$ ssh -o StrictHostKeyChecking=no [email protected] uptime
Warning: Permanently added 'something.example.com,10.11.12.13' (RSA) to the list of known hosts.