SSH refuses the connection because the host's key doesn't match what you recorded before. Sometimes that's an attack; today it's usually a rebuilt server. Verify which before you delete anything.
The common case: cloud VM re-created, container recreated with a new IP, or a reinstalled box. Old key in known_hosts, new key on the server.
DHCP or cloud IP reuse gives the address to a different server — legitimate but worth confirming out-of-band that your new server is the one answering.
The warning exists precisely for this. If you did NOT rebuild the server, do not skip verification — check with your provider console before removing keys.
# out-of-band check: provider console shows recent redeploys; then accept the new key
ssh-keygen -R <host-or-ip> # prints which line it removed from known_hosts
ssh user@host # on first connect, compare the shown fingerprint with the provider's console value
# ssh-keyscan -H host >> ~/.ssh/known_hosts (TOFU prepopulation), or use known_hosts verification via DNS SSHFP records
For ephemeral rebuild scenarios (CI, autoscaling), store host keys in config management or accept per-deploy via ssh -o StrictHostKeyChecking=accept-new — never 'no'. Fingerprint verification matters most on first connect to production: compare against the value shown in your provider's web console.
After you've confirmed out-of-band that the server was rebuilt or the IP legitimately changed, yes — that's the designed workflow. If nothing changed on your side, treat the warning as a genuine MITM indicator and investigate first.
Use StrictHostKeyChecking=accept-new for freshly provisioned hosts, and pin known_hosts explicitly for stable ones. Blanket 'no' removes your only protection against interception.
Our most-documented failures, packaged as ready-to-ship starter kits: Docker, Kubernetes, and Terraform.
Browse the template store →One-time. Yours to modify. Instant download from the NinjaOps template store.