Known Hosts
concept~/.ssh/known_hosts stores server fingerprints. Its purpose: prevent MITM attacks—someone impersonating the server you meant to reach—by verifying server identity on every connection.
The first connection to a new server is where the file earns its keep:
The authenticity of host 'server (192.0.2.10)' can't be established.
ED25519 key fingerprint is SHA256:abc123...
Are you sure you want to continue connecting (yes/no)?
What to do:
- Verify the fingerprint via an out-of-band method (ask the admin, check documentation)
- Type
yesif the fingerprint matches - The server is added to
known_hosts
Typing yes blindly defeats MITM protection. The prompt is the one moment you're actually being asked to establish trust; after that, SSH checks automatically.
Housekeeping:
cat ~/.ssh/known_hosts # see stored fingerprints
ssh-keygen -H -f ~/.ssh/known_hosts # hash entries (obscures which servers you visit)