known_hosts
Cheat sheet · https://pcornel.dk/topic.php?topic=2804
Answer
~/.ssh/known_hosts stores the host keys of servers you have connected to. ssh warns if a server presents a different key, which may mean reinstallation or a man-in-the-middle.
Remember
Verify a changed key through another channel before removing the old one (ssh-keygen -R <host>). Distribute known host keys centrally or use SSH certificates for many servers. StrictHostKeyChecking=no should not be used in production.
First checks
ssh-keygen -F <host>— find a host's stored keyssh -v user@host— client-side connection and authentication stepsjournalctl -u ssh -u sshd -e— server logsshd -T— effective server settingsss -ltnp | grep :22— sshd listening
Verify in this order
first connection stores the host key → later connections compare → match proceeds, mismatch warns
Where it usually breaks
First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2804