Server Hardening
conceptA properly hardened SSH server usually has:
- ❌ password login disabled
- ❌ direct root login disabled
- ✅ SSH key-only access
- ✅ normal user account
- ✅
sudofor privilege escalation
Why this exact shape?
Passwords:
- can be guessed
- can be phished
- can be reused
- can leak
SSH keys:
- cannot be guessed
- cannot be reused elsewhere
- cannot be brute-forced remotely
Disabling password login removes the entire category of remote guessing attacks. Disabling direct root login means an attacker needs both a working key and a way to escalate—sudo from a normal account keeps escalation visible and revocable.
Hardening is the server-side half of the key-pair bargain:
- The server stores only public keys—its list of who to trust lives in
authorized_keys, which is why auditing that file is auditing access. A hardened server with a staleauthorized_keysis only half hardened. - Passwords are the structural weakness the whole arrangement exists to remove: a shared secret the server can lose. Key-only access means there is nothing on the server worth stealing.
- Key-only cuts both ways: get the order right. Deploy your key, test that key login works, and only then turn password login off—the same test-before-revoke discipline as key rotation. A permissions mistake that makes SSH silently refuse your key ("Permission denied") on a password-disabled server is a lockout, not an inconvenience.