Host key verification failed

Last week I spend a lot of time installing and re-installing remote Ubuntu servers. Every time was trying to connect with SSH to the server it asked me whether I trusted the server. When you type `yes` (trust the server), your local machine saves the fingerprint of that server. So the next time you don’t have to type `yes` again.

The problem is: after installing a new server the fingerprint changes. When the next time you try to access the server via SSH it fails. Because your local machine does not trust the identity anymore.

To fix it you could run the following command from within your Terminal session:

ssh-keygen -R server.address.com

Replace server.address.com with the address of the server you working with.

One thought on “Host key verification failed”

  1. Thanks! I didn’t knew that one! I always removed fingerprints manually from the known_hosts file. But I prefer your method above!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>