Warning: Remote Host Identification Has Changed

Better Stack Team
Updated on November 16, 2022

What does it mean

You may wonder what WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED error means. SSH connection uses keys, files stored on the computer, to authenticate the server and the client. One part of the key works as a fingerprint of the host. This makes sure that the connection is accurate anthat d you are not part of the machine-in-the-middle attack.

If the client thinks that the host's fingerprint is different than what it thinks is correct, the Warning: Remote host identification has changed is displayed after login.

Important note:

You should not attempt to fix the issue unless you are 100% confident that the issue is not malicious.

How to fix the error

The solution is differed depending on the system.

Windows

Open a file explorer and try opening the %USERPROFILE%\.ssh or %USERPROFILE%\ssh folder. In this folder, look for the known_hosts file. If you found the file, open it and delete the key that is causing the issue.

It is possible, that the known_hosts file doesn't exist on your system. In this case, you need to look in the documentation of the SSH client that you are using where the list of known hosts is stored and apply the previous approach.

Mac

On a mac, the solution is much easier. Simply run the following command, to generate the key again:

ssh-keygen -R <you_server_hostname_or_ip>
Copied!
Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →

Reliability is the
ultimate feature

Delightful observability tools that turn your logs & monitoring into a secret weapon for shipping better software faster.

Explore Better Stack