Join our Newsletter — 33% off our NHI Course
Home› Guides› SSH Host Key Warnings for Beginners: What ‘Remote…
Guide Secrets Management

SSH Host Key Warnings for Beginners: What ‘Remote Host Identification Has Changed’ Really Means

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 1 December 2026 9 min read
On this page

An SSH host key warning means the server answered with a different identity than the one your computer remembered.

This guide is for anyone who has seen "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" and wondered whether to panic. It suits developers, new admins and anyone who runs scripts that connect to servers.

In short

  • Every SSH server has a host key that proves which server it is.
  • Your computer stores that key the first time you connect, in a known hosts file.
  • The warning appears when the key no longer matches. Often the server was rebuilt, but it could be someone in the middle.
  • Check the new key with the server owner before you remove the old one. Never just turn checking off.

What you will learn

  • Explain what a host key is and why your computer remembers it.
  • Know the safe reasons and the dangerous reasons for the warning.
  • Fix the warning safely, after checking the new key.
  • Spot risky habits in scripts and pipelines.
Server's ID card (host key)
the key a server uses to prove who it is.
Address book (known hosts file)
where your computer keeps the ID cards it has seen.
Short check code (fingerprint)
a short summary of a key that people can compare by eye.

What is an SSH host key warning?

Think of a friend you visit often. One day a stranger opens the door and says they are your friend. You would stop and ask questions before you walk in.

SSH works the same way. When you connect to a server for the first time, your SSH client shows the server's key fingerprint. It then saves the key in your known hosts file, usually ~/.ssh/known_hosts [1]. This is called trust on first use.

On every later visit, the client compares the key with the saved one. If it has changed, OpenSSH shows a warning and turns off password sign-in. Its manual says this protects against server spoofing and man-in-the-middle attacks [1].

Where the comparison stops working: you can ask a stranger at the door questions. With SSH you cannot tell a rebuilt server from a fake one by looking. You must check the key through another channel.

Why does it matter?

The warning is the only thing standing between your connection and a fake server. Ignoring it can send your files, keys or commands to the wrong place.

If you are a developer

What could happen: you delete the old key out of habit and trust a fake server.

Check this: confirm the new fingerprint with the server owner or the provider's published list.

Next: SSH Keys for Beginners

If you run scripts or pipelines

What could happen: a script with host checking switched off connects to any server that answers.

Check this: search your scripts and pipeline settings for checking turned off.

Next: How to rotate SSH host keys across a server fleet without known_hosts chaos

If you run servers

What could happen: you rebuild a server, everyone sees the warning, and they learn to click past it.

Check this: tell users before host keys change and publish the new fingerprints.

Next: Jump Servers for Beginners

What does it look like?

Here is a shortened, made-up version of the warning. The fingerprint and names are fake.

Example only. All values are made up.

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!          (1)
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!      (2)
The fingerprint for the ED25519 key sent by the remote host is
SHA256:EXAMPLEFAKEFINGERPRINT0000000000000000.             (3)
Offending key in /home/example/.ssh/known_hosts:7           (4)
Host key verification failed.                              (5)
  1. The key the server sent does not match the one you saved.
  2. The client is telling you this could be an attack.
  3. In a real file, this line would show the new key's fingerprint. This is what you check.
  4. Which line of your known hosts file holds the old key.
  5. The connection stopped. Nothing was sent.

Why this is risky: the quick fix people find online is to delete the old line and connect again. That skips the only check that matters.

The safer way: get the expected fingerprint from a trusted place first. Compare it, then update the saved key.

How does it work?

  1. First visit. The server sends its host key. Your client shows the fingerprint and, after you agree, saves it [1][2].
  2. Later visits. The client checks the key against the saved copy.
  3. Mismatch. OpenSSH refuses the connection by default when a key has changed [2].
  4. You check. The server owner can read the real fingerprint on the server itself [1]. Big providers publish theirs.
  5. You update. Only once the fingerprint matches, remove the old line and save the new key. GitHub's advice in 2023 used ssh-keygen -R with the host name to remove the old entry [3].
Diagram titled Trust on first use, and what the warning means. Four boxes joined by arrows: 1 First visit, server sends its key and your computer saves it; 2 Later visit, the key is compared with the saved copy; 3 Mismatch, warning shown and connection stopped; 4 Check the new fingerprint with the owner, then update the saved key. A note underneath says safe causes include a rebuilt server or planned key change, and the risky cause is someone in the middle, so always check before you update.
Figure 1. Your computer trusts a key on the first visit and checks it every time after.

The setting that controls this is called StrictHostKeyChecking. Its default, ask, saves new keys only after you confirm and refuses changed keys. The value accept-new saves new keys without asking but still refuses changed ones. The value no lets changed-key connections go ahead, with some limits [2].

A worked example

This is based on a real event, told in plain words.

In March 2023, GitHub replaced the RSA host key for GitHub.com. It found that the private key had been briefly exposed in a public repository. GitHub said it had no sign the key had been misused and changed it as a precaution [3].

Developers who still had the old RSA key saved got a shock. Their screens showed "REMOTE HOST IDENTIFICATION HAS CHANGED!" and then "Host key verification failed." Only the RSA key changed. Other key types and web traffic were not affected [3].

Imagine Yara Rosen, a developer at a small agency, sees the warning that morning. She does not delete the line straight away. She opens GitHub's blog post, finds the new fingerprint and compares it with the one in her warning. They match.

Now she removes the old entry, as GitHub advised, and connects again [3]. Her build pipeline also breaks. GitHub's post warned that some pipelines using SSH keys could fail and needed updating [3]. Yara updates the stored key in the pipeline settings rather than switching checking off.

The lesson: the warning was harmless this time, but only checking the fingerprint proved it. Had the numbers not matched, Yara would have stopped and told her team lead.

Myths and mistakes

What people thinkWhat is true
The warning is always a false alarm.Usually the server changed, but the warning exists to catch spoofing and man-in-the-middle attacks[1].
Deleting the old line is the fix.Deleting it is the last step, after you check the new fingerprint.
Turning checking off makes scripts reliable.It also lets them talk to any server. Store the right key instead.
Host keys never change.They change when servers are rebuilt or keys are rotated, as GitHub did in 2023[3].
This is about my own SSH key.Host keys belong to the server. Your own key proves who you are to the server.

What can I do this week?

  • Find where your team's key servers publish their host key fingerprints.
  • Search scripts and pipeline settings for host key checking switched off.
  • Agree who to ask when someone sees the warning.
  • If you run servers, plan how you will announce a host key change.

Checklist

  • I know the warning means the server's key changed.
  • I check the new fingerprint before I trust it.
  • I get the fingerprint from a trusted place, not from the warning alone.
  • I remove the old entry only after the check.
  • My scripts keep host key checking on.
  • I tell users before I change a server's host key.

Common questions

Is "remote host identification has changed" a hack?

Most of the time it is not. The server may have been rebuilt, moved or had its keys changed. But the warning cannot tell those apart from a fake server, so you must check the fingerprint through a trusted channel before you carry on.

How do I fix it safely?

Ask the server owner, or check the provider's published list, for the new fingerprint. Compare it with the one in the warning. If they match, remove the old entry from your known hosts file and connect again. GitHub's 2023 advice used ssh-keygen -R for the removal[3].

Should I set StrictHostKeyChecking to no?

No. That setting lets connections to changed-key hosts go ahead[2], which removes the protection. For automated jobs, store the correct host key in advance. The accept-new value still refuses changed keys.

Why does this matter for scripts and machine accounts?

Scripts, build pipelines and AI agents connect to servers with no person watching. If host checking is off, nobody notices when a server is swapped. Keeping the right host key stored is how these machine identities know they reached the real server.

Where next?

Ready for the detail? Read the practitioner guide: How to rotate SSH host keys across a server fleet without known_hosts chaos. It covers planned key changes across many servers, and host certificates.

Also useful:

Related NHI Mgmt Group resources: Least Privilege for Beginners and Privilege Escalation for Beginners.

Key terms

Host key
The key pair a server uses to prove its identity to SSH clients.
Known hosts file
A file where an SSH client stores the host keys of servers it has connected to.
Host key fingerprint
A short summary of a host key that people can compare to check it.
Trust on first use
Trusting a key the first time you see it and checking against it on later visits.
Man-in-the-middle attack
An attack where someone secretly sits between two parties and reads or changes their traffic.
Host key rotation
Replacing a server's host key in a planned way.

Sources and further reading

  1. OpenBSD manual pages, "ssh(1): OpenSSH remote login client". https://man.openbsd.org/ssh (accessed 30 Nov 2026).
  2. OpenBSD manual pages, "ssh_config(5): OpenSSH client configuration file", StrictHostKeyChecking. https://man.openbsd.org/ssh_config (accessed 30 Nov 2026).
  3. GitHub, "We updated our RSA SSH host key", The GitHub Blog, 24 March 2023. https://github.blog/news-insights/company-news/we-updated-our-rsa-ssh-host-key/ (accessed 30 Nov 2026).

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.