You ran ssh root@your-server and got a wall of @ signs ending in "Host key verification failed." Stop before you delete anything. Your computer remembers a different identity for that server than the one it just saw, and the safe fix takes about 2 minutes once you know why it changed.
Quick Answer: This SSH error means the server's host key no longer matches the copy saved in
~/.ssh/known_hosts. Confirm why it changed first: open your provider's web console, runssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub, and compare that fingerprint with the one in the warning. If they match, runssh-keygen -R your-server-ip, reconnect and typeyes. If they don't match, don't connect.
Last verified: September 2026, against OpenSSH 10.4 (upstream) and OpenSSH 9.6p1 on Ubuntu 24.04 LTS.
Our engineers work through 20 to 30 client issues a day, and SSH lockouts after a rebuild or migration come up often. This guide follows the order we check things in, so you can do it yourself on Linux, macOS, Windows or inside a deploy pipeline.
What Host Key Verification Failed Actually Means
SSH refused to log you in because the server presented a different identity from the one your computer saved last time. Nothing is broken on the server. Your client is doing its job.
Every SSH server keeps host key pairs in /etc/ssh/. The first time you connect, your client saves the server's public key in ~/.ssh/known_hosts. On every later login it checks that key again. This trust model is described in the SSH protocol architecture (RFC 4251). When the keys don't match, you see this:
bash@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! The fingerprint for the ED25519 key sent by the remote host is SHA256:Vq3cH1l0gP8xR2mYt6ZkLw9aN4bE7uJd5sQfT0oXyC8. Offending ED25519 key in /home/you/.ssh/known_hosts:12 Host key verification failed.
Three details matter. The key type (ED25519, ECDSA or RSA) tells you which file to check on the server. The SHA256 string is the fingerprint you'll verify. And known_hosts:12 points to the exact line holding the old entry.
As of September 2026, OpenSSH clients save a server's public host key on the first connection and compare it on every login after that. When the key changes, the client blocks the session before any password is sent. Typing credentials into an impersonated server would hand them straight to an attacker, which is why the warning looks so alarming.
Could someone actually be intercepting my connection?
Rarely, but yes, and that possibility is the reason the check exists. A real interception needs an attacker on your network path, such as hostile public Wi-Fi, a compromised router or a hijacked DNS record. If nobody rebuilt the server, moved it or changed its IP, treat this SSH man-in-the-middle warning as real. Don't connect until you've verified the fingerprint another way.
Why the Server's Key Changed: Causes Ranked by How Often We See Them
In almost every case, the server changed and nothing malicious happened. These are the causes in the order they turn up in the tickets we handle:
- The server was reinstalled, rebuilt or restored. A fresh OS install generates new host keys on first boot, so the same IP now answers with a new identity.
- The IP or hostname now points at a different machine. You migrated to a new VPS and updated DNS, or you were given an IP you'd connected to before on another server.
- One IP fronts several machines. NAT port forwarding, a load balancer or a container on port 2222 can each present their own keys.
- Someone rotated the keys on purpose. An admin regenerated them after an upgrade or dropped an old RSA key.
- Genuine interception. This is the rare case, and the only one where clicking through costs you.
According to Hostaccent's support-queue data (September 2026), Linux server issues make up about 25% of our monthly tickets. Access problems after a server change are a regular part of that share.
Most host key changes in 2026 come from routine operations, not attacks. A VPS reinstall writes fresh keys to /etc/ssh on first boot, and a migration points an old hostname at a new machine with different keys. Genuine man-in-the-middle interception is the rare exception, but it's the one case where connecting anyway can cost you a root password within seconds.
The 3-Question Why Check
Before our engineers touch a known_hosts file, they answer three questions:
- Did anyone rebuild, reinstall or restore this server in the last 7 days?
- Did its IP address, DNS record or SSH port change?
- Does the fingerprint on the server's own console match the one in the warning?
If the answer to either of the first two is yes and the third is also yes, it's safe to proceed. If all three answers are no, stop and investigate.
Across the 4,000+ sites Hostaccent has migrated since 2016, people most often skip the console comparison. They switch DNS to the new server, connect by hostname the next morning, and wipe the file without checking which machine answered. Usually it's the right one. Occasionally a stale DNS cache has sent them to the old server.
Prefer a specialist-managed migration?
Eligible moves into Hostaccent hosting are included at no separate migration charge. Independent migrations between other providers are scoped and quoted before work begins.
The Safe Fix, Step by Step
Verify the fingerprint through a channel an attacker can't touch, then remove only the stale entry.
Step 1: Read the real fingerprint on the server. Log in through your provider's web, VNC or KVM console, not SSH. Then run the command that matches the key type in your warning:
bashssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub
If you don't manage the server, ask whoever rebuilt it to send you this fingerprint.
Step 2: Compare it with the warning. The SHA256 string must match character for character. You can also run ssh-keyscan -t ed25519 203.0.113.10 | ssh-keygen -lf - from your own machine. Be aware that this only shows what the network is handing you, so it proves nothing until it matches the console.
Step 3: Back up your known_hosts file.
bashcp ~/.ssh/known_hosts ~/.ssh/known_hosts.bak
Step 4: Remove only the stale entry. The general form is ssh-keygen -R host:
bashssh-keygen -R 203.0.113.10 ssh-keygen -R server.example.com ssh-keygen -R "[203.0.113.10]:2222"
Run it for every name you connect with: the IP, the hostname, and the bracketed form if you use a custom port. The ssh-keygen manual covers every flag. You can also delete the line number from the warning directly. sed -i '12d' ~/.ssh/known_hosts works on Linux, but macOS needs sed -i '' '12d' ~/.ssh/known_hosts.
Pro Tip: Ubuntu and Debian set
HashKnownHosts yesin/etc/ssh/ssh_config. Your known_hosts file then stores hashes instead of names, sogrepfinds nothing. Usessh-keygen -F 203.0.113.10to locate a host's entry instead.
Live site and no time to experiment? Our engineers can fix this for a small one-time fee, and you'll see the exact quote before we touch anything. Hosted with Hostaccent? Then issues like this are covered by support, free. Have an engineer fix it
Step 5: Reconnect and accept the new key. SSH now treats the server as new and shows its fingerprint. Check it against Step 1 one more time, then type yes.
Clearing a changed SSH host key safely in 2026 takes about 2 minutes. Read the real fingerprint from the server's console, compare it with the warning, back up ~/.ssh/known_hosts, then remove only that host's entry with ssh-keygen -R. Deleting the whole file also works, but it discards every other server's verified identity without telling you.
On Windows: OpenSSH and PuTTY
Windows 10 and 11 ship the same OpenSSH client, so ssh-keygen -R 203.0.113.10 works in PowerShell. The file lives at %USERPROFILE%\.ssh\known_hosts. PuTTY stores keys in the registry under HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys and shows a security alert when a key changes. Accept the new key only after the Step 1 check. If the connection then fails on the password instead, that's a separate fault covered in FTP 530 Login Authentication Failed: How to Fix It.
Confirm the Fix and Stop the Warning Coming Back
Connect twice. The first login should ask you to accept the new key. The second should go straight to your password or key prompt with no warning. If it does, you're done.
Still not working? Check these
- You used sudo.
sudo sshorsudo git pullreads/root/.ssh/known_hosts, not yours. Runsudo ssh-keygen -R 203.0.113.10. - The file now belongs to root. If you see "Failed to add the host to the list of known hosts", fix ownership with
sudo chown $USER:$USER ~/.ssh/known_hosts. - You connect through an alias in
~/.ssh/config. Remove the entry for both the real HostName and the alias. - It's a script or CI job. A job with no terminal can't answer "yes", so it fails with
No ED25519 host key is known for 203.0.113.10 and you have requested strict checking.Verify the key once, then store thessh-keyscanoutput as a known_hosts secret. TheStrictHostKeyChecking accept-newoption in ssh_config accepts brand-new hosts but still refuses changed keys.
If SSH hangs or drops instead of showing a key warning, that's a different problem, often memory pressure. See Why Is My VPS Running Out of RAM? How to Diagnose and Fix It.
Pro Tip: Before any planned reinstall, copy the host keys off the server with
sudo tar czf ssh-hostkeys.tgz /etc/ssh/ssh_host_*. Restore them after the rebuild and runsudo systemctl restart ssh. Nobody who connects will see a warning.
A default Ubuntu 24.04 install keeps three host key pairs (six files) under /etc/ssh/ssh_host_*. Backing them up takes about 10 seconds. If you restore them after a rebuild, every client keeps trusting the server without anyone editing a known_hosts file. It's the cheapest prevention step there is, and most rebuild checklists leave it out.
For servers you share with a team, publish SSHFP records in DNS as described in RFC 4255. Generate them with ssh-keygen -r server.example.com, sign the zone with DNSSEC, and set VerifyHostKeyDNS yes on clients. SSH then checks keys against signed DNS instead of asking people to trust a prompt. While you're finishing a rebuild, also reset the root password and confirm your SSL renewals still run, since a fresh server often breaks them. Certbot Renewal Failed? Fix Let's Encrypt SSL (2026) covers that.
Your Next Step: Fixed It, or Still Locked Out?
Three habits worth keeping:
- Verify the fingerprint through the console before trusting a new key.
- Remove one entry with
ssh-keygen -R, never the whole file. - Back up
/etc/ssh/ssh_host_*before every rebuild.
You fixed it. The warning usually traces back to a rebuild or a moved IP. On a well-run VPS, a host key verification failed lockout is support's job, not yours. Start on the Basic VPS plan at Basic, $7.99/mo (renews at $7.99/mo). It comes with full root access, free 30 Gbps DDoS protection, 24/7 help from our own engineers and a 30-day money-back guarantee. One honest caveat: no cPanel or Plesk licence is included, so budget for one if you want a panel.
Still stuck? Open a ticket with Hostaccent's engineers. It's a small one-time fee, and you'll see the exact quote before any work starts.
Frequently Asked Questions
Is it safe to delete the whole known_hosts file?
It works, but it's a blunt fix. Deleting ~/.ssh/known_hosts removes the saved identity of every server you've ever connected to. Your next login to each one shows a first-time prompt that you'll probably accept without checking, which switches off the protection for all of them. Removing a single entry with ssh-keygen -R fixes only the host that changed and keeps the rest verified. Keep a backup either way.
How do I fix host key verification failed in a CI/CD pipeline?
Pipelines run without a terminal, so SSH can't ask you to accept a new key and the job fails. Verify the server's fingerprint from its console once. Then run ssh-keyscan -t ed25519 your-server and save the output as a secret that your job writes to ~/.ssh/known_hosts before connecting. Update that secret whenever the server is rebuilt. Don't disable host checking, because pipelines often hold deploy keys worth stealing.
What does "remote host identification has changed" mean?
It's the banner OpenSSH prints just before refusing the connection. It means the key the server just presented differs from the one saved for that hostname or IP in your known_hosts file. The usual reasons are a reinstall, a migration or a reused IP address. The banner mentions a man-in-the-middle attack because that's the dangerous possibility. The only way to rule it out is to compare fingerprints through the server's console.
Can I just set StrictHostKeyChecking=no?
You can, but you shouldn't leave it on. With StrictHostKeyChecking=no, SSH accepts any key from any server, including an impersonator, so the protection disappears and you won't be warned next time. For scripts, accept-new is the safer middle ground: new hosts are added automatically, but a changed key still stops the connection. For interactive work, keep the default and verify the fingerprint whenever the prompt appears.
Why do I see this warning after reinstalling my VPS?
Reinstalling the operating system generates brand-new host keys on first boot, so your computer sees a different identity at the same IP address. That's expected and usually harmless. Check the new fingerprint through your provider's console, run ssh-keygen -R with the server's IP, and reconnect. To avoid it next time, back up the files matching /etc/ssh/ssh_host_* before the reinstall, restore them afterwards, and restart the SSH service.












Discussion
Have a question or tip about this topic? Share it below — your comment will appear after review.