By Ellie / Last Updated July 12, 2023

SSH - Remote host identification has changed

 

I've reinstalled my server and I am getting the message: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! How do I resolve this warning?”

- Question from Stack Overflow

Remote Host Identification Has Changed

The occurrence of the "Warning: Remote host identification has changed" error is intended to protect your connection from potential malicious attacks, although sometimes it can be unintentionally triggered.

This error is associated with Secure Shell (SSH) keys and the server's "fingerprint" that a client checks for. When Secure Shell detects an issue, it blocks access to your server and displays an error message. However, you can resolve this problem by following a few simple steps.

Why SSH “Warning: Remote host identification has changed” error happens?

SSH is commonly used for establishing secure connections to web servers. It allows secure access to insecure networks. The "Warning: Remote host identification has changed" error occurs during SSH authentication. Dedicated keys are used for authentication, similar to SSL. These keys provide a permanent fingerprint of the host server to protect against attacks. When the client detects a different fingerprint, the error is displayed. The error message provides details and solutions. The known_hosts file stores SSH remote hosts for authentication. If the fingerprint differs, it may indicate a potential threat. Exercise caution when encountering this situation.

How to fix SSH “Warning: Remote host identification has changed”

Now, let's dive into the steps for fixing the "Warning: Remote host identification has changed" error on both Windows and Mac.

How to fix SSH “Warning: Remote host identification has changed” on Windows

Step 1. It's worth noting that Windows machines may not have a known_hosts file, but if you use the OpenSSH client, such a file exists. To locate it, open the Windows search bar and enter the command "%USERPROFILE%" to access your user folder.

Step 2. This will open the File Explorer, and navigate to the .ssh folder.

SSH File Explorer

Step 3. Locate and open the known_hosts file using a text editor like Notepad. It contains a list of keys.

Windows Known Hosts

Step 4. Identify and delete the problematic key from the file. Save the changes.

For PuTTY users, the keys are stored in the Registry. Follow these steps:

Step 1. Access the Windows Registry Editor ("regedit") through Windows Key + R.

Run Box Regedit

Step 2. Navigate to the following location in regedit:

HKEY_CURRENT_USER/Software/SimonTatham/PuTTY/SshHostKeys/

Step 3. You will see a list of entries representing the saved connections on your computer. Delete the entry that is causing the issue:

Regedit Host Keys Putty

Step 4. After clicking on the Delete button, confirm that you want to remove the key.

PuTTy Confirm

Step 5. By following these steps, you will permanently remove the key, and the "Warning: Remote host identification has changed" error should no longer appear.

How to fix SSH “Warning: Remote host identification has changed” on Mac

There is a method for fixing the "Warning: Remote host identification has changed" on Mac. You can use a premium app like SSH Config Editor or the Terminal. Either method will yield the same results, so choose the option that is most comfortable and fits your budget.

We recommend using Terminal and a dedicated text editor like Nano or Vim, as they are accessible and user-friendly regardless of your level of experience.

Step 1. Let's proceed with the Nano editor. Start by opening the Terminal using your preferred method:

Nano Known Hosts

Step 2. In the Terminal window, enter the command "nano ~/.ssh/known_hosts" to open a new Nano instance and display the keys in your known_hosts file:

Nano Known Hosts

Step 3. Identify the key that is causing the "Warning: Remote host identification has changed" error and delete it, then save your changes.

Bonus tip: Safe & secure remote desktop software AnyViewer

AnyViewer, a Windows-based remote desktop software, offers users a cost-free solution for seamless remote access. With its robust security measures, including Elliptic Curve Cryptography (ECC) end-to-end encryption, AnyViewer ensures a completely safe and secure remote access experience. Unlike SSH, AnyViewer boasts a user-friendly graphical user interface (GUI), making it remarkably straightforward and intuitive to operate. By opting for AnyViewer, users can bid farewell to the hassle of dealing with the recurrent SSH error message, "Warning: Remote host identification has changed", as it provides a reliable alternative for establishing remote connections.

Download Freeware Win 11/10/8.1/8/7/Servers
Secure Download

Step 1. Download, install, and run the remote access tool on both local and remote devices.

Step 2. On the remote device, sign up for AnyViewer and sign in to the account in advance.

Sign Up

Step 3. On the local device, log in to the same account, then go to "Device" and locate the remote PC. Click it and choose "One-click control" to access the unattended device with one click.

Devices

It's recommended to upgrade to a Professional or Enterprise plan to enjoy more rights:
Connect in privacy mode: You can black the screen and block the mouse and keyboard of the remote computer to protect your privacy when your remote computer is located in an open place.
Assign more devices: You can assign more devices to the same account for a secure one-click remote connection.
Control more PCs: You can control more computers from one computer at the same time.
High-image quality: You can change the mode to high-image quality for a better remtoe connection experience.
▶ ...

The bottom line

Although the system works effectively, the SSH "Warning: Remote host identification has changed" error can occur for various reasons, some of which are harmless. Fortunately, resolving this error is a straightforward process that can be achieved using commands in a Command Prompt or Terminal window.

Alternatively, you may consider exploring an alternative remote desktop software option, such as AnyViewer. Distinguished by its user-friendly graphical interface, AnyViewer offers a seamless remote desktop experience. Additionally, AnyViewer guarantees secure remote connections through its implementation of Elliptic Curve Cryptography (ECC) end-to-end encryption, ensuring the utmost safety and protection.