How To Fix “Warning: Remote Host Identification Has Changed” Error

Fix-the-Warning-Remote-Host-Identification-Has-Changed-Error

You should not undermine the significance of a secure internet connection. Moreover, you must prioritize it to safeguard your websites. The “Warning: Remote host identification has changed” error is one error that defends your sites against dangerous attacks.

However, you can unintentionally cause this error for numerous reasons.

This blog post will describe fixing the “Warning: Remote host identification has changed” error.

What Do You Mean By the “Warning: Remote Host Identification Has Changed” Error?

SSH (Secure Shell) helps you connect to a web server securely. This command-line tool also allows users to connect to an insecure network securely.

There is no denying that you can access your website without difficulty using the Internet from anywhere, provided you use the proper login credentials.

Whether you use a Windows or a Mac device, SSH client comes pre-installed on these devices.

Regarding the “Warning: Remote host identification has changed” error, it denotes the security checks your client will perform. As for the SSH connection, it uses dedicated keys, and you can assume these keys are small files saved on your devices.

An SSH connection heavily depends on dedicated keys for authentication purposes. These keys work like digital signatures, authenticating users’ identities when they connect to remote servers.

Users witness the “Warning: Remote host identification has changed” message on their screens when they connect over SSH to remote servers. The server’s public key does not match the dedicated keys stored on their local devices.

Remote host identification has changed

The above “Warning: Remote host identification has changed” error indicates what has happened. It also describes the potential cause and what steps you must take to bypass this annoying error.

Before we explain how to fix the “Warning: Remote host identification has changed” error, it is crucial to understand how the known_hosts file assists SSH authentication.

How Does the Known_Hosts File Help SSH Authentication?

The “Warning: Remote host identification has changed” error indicates a known_hosts file. A known_hosts file is a list of SSH remote hosts a device knows. It acts like a reference client file and is handy in authentication.

Once a user connects to a server, they usually receive a confirmation request through their interface asking if they wish to connect. This fingerprint becomes a critical element of their known_hosts file if this is the case.

According to the above scenario, the fingerprints must match those in the known_hosts file. If they do not match, a hacker likely targets the user.

What Are the Potential Reasons Behind the “Warning: Remote Host Identification Has Changed” Error?

Users can experience this error due to different possible reasons, including:

  • Man-in-the-middle attack
  • Changes in network infrastructure
  • Reconfiguration of the operating system

What Should We Do to Fix the “Warning: Remote Host Identification Has Changed” Error?

Fortunately, you can appropriately bypass this SSH error message on Windows and Mac devices. If you want to fix the “Warning: Remote Host identification has changed” error on Windows, here is what you should do:

NOTE: Before attempting any troubleshooting steps to bypass the “Warning: Remote host identification has changed” error, you must ensure that there are no security risks involved in the entire process.

Windows

Windows

There is a chance you may not find the known_hosts file on your Windows devices. That said, you can still find a file using the OpenSSH client.

To access the file, you should go to your user folder after opening the Windows search bar and write the following command:

%USERPROFILE

%USERPROFILE

You can access the directory through the File Explorer. Within the directory, you will find the .ssh folder. Through this folder, we can obtain the required file, known_hosts.

You can use your desired text editor or Notepad to open this file. As a result, you will find a list of keys within the known_hosts file.

Now, you can delete the key that is the main culprit behind the “Warning: Remote host identification has changed” error. After deleting the key, resave the file.

You can consider using the Putty client when deleting the key in the known_hosts file. We explain the Putty client for your convenience if you need to learn it.

Putty is an open-source and free terminal emulator, serial console, and network file transfer application for Windows devices. With this terminal emulator, users can easily connect to remote devices or computers using several protocols, including SSH (secure socket shell), login, Telnet, etc.

Coming back to the point, you should open the Windows Registry Editor. For this purpose, use the Windows search bar to write the app’s name:

Windows-Registry-Editor

Now, search for the following destination within the Registry Editor (the destination may vary depending on the users’ names and devices):

HKEY_CURRENT_USER/Software/UsmanHayat/PuTTY/SshHostKeys/

You will see a list of entries associated with the saved connections on your device. Delete the ones causing this SSH error.  Once you have clicked the Delete button, remember to click the Yes button to remove or delete the key.

Thus, you will no longer receive the “Warning: Remote host identification has changed” error.

Mac

Mac

Fortunately, you can benefit from two different methods when fixing the “Warning: Remote host identification has changed” error. The first method is a paid app such as SSH Config Editor. The second method is Terminal.

These methods offer the same result to users: they comprehensively remove the “Warning: Remote host identification has changed” error.

If you agree with our choice, you should access the file using a Nano or Vim editor within the terminal window. This method is suitable because it is simple, and anyone can easily follow it to get the desired outcome.

If you use Nano, you should open your terminal regardless of your chosen method:

Write the “nano ~/.ssh/known_hosts” command using your window. This way, you will see a new Nano instance on your screen, showing the keys within your known_hosts file.

Now, you must remove the key, which results in the Warning: Remote host identification has changed error. Once you remove the key, save the changes.

If you utilize SSH for one website, write “rm.ssh/known_hosts” in the terminal window to delete the entire known_hosts file.

You can use another method to remove the known_hosts file on Mac. This method uses the ssh-keygen utility from the command line.

You should open your terminal window and write ssh-keygen with the server hostname.

For instance: ssh-keygen-R server.example.com

Remember, you must ensure that you remove the desired key, as you will not get an option suggesting if you wish to delete the specified lines. So, proceed with caution.

Once you have performed this step, hopefully, you will not see the “Warning: Remote host identification has changed” error again.

Wrapping Up

We hope you liked our blog post describing the “Warning: Remote host identification has changed” error. Website protection is not only about configuring plugins and developing robust passwords.

Unfortunately, users can see the unwanted “Warning: Remote host identification has changed” error message on their screens for several reasons, some of which are pretty obvious.

You can still smartly bypass the error by following the above methods.

Share This Article