Linux: SSH Remote host identification has changed

If you encountered the ever so terrifying following error, this post will quickly address how to correct it.

First, it’s important to know how and why this error occurs. Maybe you manually updated the key, or maybe you just reinstalled Linux on the server you are now trying to SSH. Either way, there’s a quick and simple way to update the key.


Grab the text output, including the IP address, if you please. Next, use your favorite text editor to edit your known_hosts file. In this example, I will use vim:

Search for the IP address of the known host, remove the existing key and then paste what you copied.

Tip: Make sure the IP address is only present once

Save the file (type: ‘wq‘ for write / quit in vim) and then you’ll be able to SSH again!

Reminder: All of my posts are provided "AS IS", imply no warranties, and confer no rights or special privileges. Use of included postings, code samples and other works are subject to the terms specified at Microsoft. For more information, click here.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.