The “Host key verification failed” error is a security feature of SSH. It occurs when the identification key (fingerprint) of the remote server you are trying to access has changed since your last connection. To protect you from “man-in-the-middle” attacks, SSH blocks the connection until the outdated key is updated or removed.
The quick fix: Using the ssh-keygen command
The most efficient way to fix this error is to use the ssh-keygen tool to remove the outdated key for a specific IP address or domain.
- Open your terminal (macOS/Linux) or PowerShell (Windows).
- Run the following command, replacing [IP_ADDRESS] with your server’s IP:
ssh-keygen -R [IP_ADDRESS]
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.
- The output will confirm that the known_hosts file has been updated. You can now try reconnecting.
The manual fix: Editing the known_hosts file
If the command above does not work, you can manually open and edit the storage file to remove the offending fingerprint.
- Locate your known_hosts file:
- Linux/macOS:
~/.ssh/known_hosts
- Windows:
C:\Users\YourUsername\.ssh\known_hosts
- Linux/macOS:
- Open the file with a plain text editor (like Notepad or Nano).
- Find and delete the entire line that starts with your server’s IP address or hostname.
- Save the file and try connecting to your VPS again using SSH.
The “Ignore” fix (Troubleshooting only)
You can tell SSH to skip the strict key checking temporarily. Use this method only for debugging in a controlled environment.
ssh -o StrictHostKeyChecking=no username@ip_address
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
The “Host key verification failed” error is a common part of VPS management, especially after re-installing an OS or changing server IPs. By using the ssh-keygen -R command, you can quickly refresh your local computer’s security records and re-establish a secure connection to your Hostinger VPS.
Notes:
- Gradual Rollout: This security feature is universal to all SSH connections.
- Root Access: These fixes are applied on your local computer, so you do not need root access on the remote server to perform them.
- Multiple Entries: If you connect to the same server via both IP and a domain name, you may need to run the ssh-keygen -R command for both addresses.

