What's changed: Initial version (topic 2.12, subtopics 2.12.1–2.12.4)
6.2Configuring and Managing the OpenSSH Server
Learn sshd configuration via /etc/ssh/sshd_config: host keys (/etc/ssh/ssh_host_*_key/ssh_host_*_key.pub), controlling root login with PermitRootLogin, public key auth with PubkeyAuthentication, restricting users with AllowUsers, and PasswordAuthentication.
Remote administration hinges on sshd, the OpenSSH server daemon. Left at defaults and exposed externally, it becomes a brute-force target, so L2 tests whether you can precisely apply the standard hardening moves—disabling root login, standardizing on key auth, and restricting which users may connect—down to the exact directive spelling.
6.2.1Key sshd_config directives
- The config file is /etc/ssh/sshd_config. After editing, check syntax (
sshd -t) beforesystemctl reload sshd—restarting with a broken config risks locking yourself out. - PermitRootLogin controls direct root login:
nodisables it entirely,prohibit-passworddisables password auth for root while still allowing key-based root login. The standard hardening choice isno. - PubkeyAuthentication toggles public key authentication (often
yesby default). PasswordAuthentication toggles password authentication; to enforce key-only auth, setPasswordAuthentication no. - AllowUsers lists space-separated users allowed to connect (e.g.,
AllowUsers alice bob)—a whitelist: anyone not listed is denied.
Continue reading — free sign-up
You're reading the free preview. Sign up free to read this section in full, plus every chapter (including 4+) and all questions.

