Instiq
Chapter 6 · System security·v1.0.0·Updated 7/7/2026·~13 min

What's changed: Initial version (topic 2.12, subtopics 2.12.1–2.12.4)

6.2Configuring and Managing the OpenSSH Server

Key points

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) before systemctl reload sshd—restarting with a broken config risks locking yourself out.
  • PermitRootLogin controls direct root login: no disables it entirely, prohibit-password disables password auth for root while still allowing key-based root login. The standard hardening choice is no.
  • PubkeyAuthentication toggles public key authentication (often yes by default). PasswordAuthentication toggles password authentication; to enforce key-only auth, set PasswordAuthentication 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.