Interview Prep/Linux/Networking, SSH and remote access

Users connecting to a new server get "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED". The server was rebuilt. How do you handle this at scale?

AdvancedScenarioNetworking, SSH and remote access
Answer

Situation read → New host keys; you need a trusted way to distribute them.

What I'd do →

  1. Confirm the rebuild is real (out-of-band check of the fingerprint: ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub on the console).
  2. Remove the stale entry: ssh-keygen -R host.example.com.
  3. Long term, sign host keys with an SSH CA and have clients trust it:
# client ~/.ssh/known_hosts
@cert-authority *.example.com ssh-ed25519 AAAA...CA

Servers use HostCertificate /etc/ssh/ssh_host_ed25519_key-cert.pub.

Why → With host certificates, rebuilt servers just get a new signed cert and clients never see warnings or need TOFU.

Interview tip → Never tell people to use StrictHostKeyChecking=no; that's exactly how MITM gets through.

All Linux questions Roadmap: Linux

More on Networking, SSH and remote access