SSH and Host Identity
Quick answer
SSH provides an encrypted channel for remote administration. First verify the server identity; then authenticate as an authorized user. Encryption alone does not establish that the server is the intended one.
Prepare the practice environment
Run python3 lab-fixtures/ssh-transfer/setup.py from the extracted package root as an ordinary user. Enter the printed private path and check pwd. Use a fresh fixture and Bash with LC_ALL=C and pipefail. Only local rsync and synthetic files are tested here. For manual SSH examples use an isolated authorized VM network, snapshot, console access, provisioned learner account and independently verified host keys; see the lab guide. Never use real credentials or external hosts.
How it works
Host keys identify servers, while user keys identify clients for authentication. A known_hosts file records trusted host keys; authorized_keys lists permitted public user keys for an account. Compare the host fingerprint through an independent trusted channel, such as the lab VM console. A changed key may indicate a legitimate rebuild or an impersonation attempt; stop and investigate. SSH exit status normally reflects the remote command, with 255 for SSH errors; a remote command can also return 255.
Imagine a learner has a valid account and key but the presented host fingerprint differs from the verified lab record. Account authorization does not resolve that mismatch. Check with the lab owner or console before accepting any new identity. Conversely, a verified host key does not grant access to an account; user authentication and server policy still apply.
Try the examples
awk '$1=="lab-server.example" {print $1, $2}' hosts.txtThis inventory is documentation, not a valid known_hosts file or proof of trust.
Expected stdout:
lab-server.example ED25519VM only: populate the fresh file with a host key independently verified at the VM console. A missing match is not proof of compromise.
Manual example; not executed locally. Follow its stated environment restrictions.
ssh -o StrictHostKeyChecking=yes -o UserKnownHostsFile=./known_hosts learner@lab-server.exampleVM only: resolve the fictional name inside the isolated lab, provision learner and trusted host key first. Exit with exit when finished.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Never bypass host-key checking or remove a changed entry merely to make a connection succeed. Authentication does not grant every administrative privilege.
Practice
Explain which key lives on the server and which file on the client establishes server trust. Write a three-step response to an unexpected changed fingerprint.
Related references
Study: ssh, ssh-keygen. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
SSH and host identity — Knowledge Check
Apply SSH trust and transfer concepts to synthetic fixtures and VM-only scenarios.
What does a host key establish?
A known fingerprint changes. What first?
Where are permitted user public keys normally recorded?
Does encryption alone establish the intended server?