Warning: Remote Host Identification Has Changed

Better Stack Team
Updated on October 11, 2023

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>
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.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github