Skip to main content
All CollectionsVPSVPS Management
How to Fix the "Host Key Verification Failed" Error
How to Fix the "Host Key Verification Failed" Error

Fixing failed verification error when connecting via SSH to your VPS

Updated over a year ago

If you are trying to connect to a remote server using SSH and encounter the "Host key verification failed" or the "Remote host identification has changed" warning, it indicates that your SSH client cannot verify the authenticity of the host you are connecting to.

Although it may look like a severe issue due to the nature of the warning, one of the most common reasons is not related to an attack: this usually happens whenever you have changed the OS on your VPS, if you reinstalled the OS or changed the root user password.

To fix it, follow these steps:

Step 1 - Remove the Entry From the known_hosts File

When you first connected to your VPS via SSH, a host key was added to the known_hosts file on your local device. Now, after changing or reinstalling your OS, this entry is outdated and needs to be removed. You can do so by entering the following command on the Terminal:

ssh-keygen -R [vps-ip]

Make sure to replace [vps-ip] with the IP of your VPS. This will create a backup copy of the known_hosts file and delete the host key entry associated with your VPS IP.

Step 2 - Connect to the Server

Now that the old entry is removed try connecting to your VPS again using SSH. This time,

you should be able to verify the host key and connect without issues.

If you are still unable to connect after following the steps above, you can try the following:

  • Verify that you are connecting to the correct IP address (or hostname)

  • Ensure that your firewall is not blocking the connection

  • Restart your local device or the VPS to reset the network settings

Did this answer your question?