Bitzu

CPSA ยท Unix network file, trust and remote access services

Securing SSH

Disabling root login and passwords, key management, version and cipher restrictions.

Key points

  • Hardening is done in sshd_config.
  • Typical measures: PermitRootLogin no, PasswordAuthentication no (keys only), AllowUsers to limit who may log in, restricted Ciphers and KexAlgorithms to strong modern algorithms, SSH-2 only.
  • Protect private keys with passphrases and correct file permissions, remove stale entries from authorized_keys, and keep the server patched.

Source: https://man.openbsd.org/sshd_config

Practice questions

Single choice

Which sshd_config setting stops root from logging in over SSH at all?

  1. PermitRootLogin no
  2. PermitRootLogin prohibit-password
  3. PasswordAuthentication no
  4. AllowUsers root
Show answer

Answer: A. PermitRootLogin no

PermitRootLogin no blocks root login. The default prohibit-password still allows root key logins, and PasswordAuthentication affects every user, not just root.

Select all that apply

Which are valid hardening measures for an SSH server?

  1. Restrict logins with AllowUsers
  2. Disable password authentication in favour of keys
  3. Remove weak algorithms from Ciphers
  4. Permit empty passwords
  5. Re-enable SSH-1 for old clients
Show answer

Answer: A. Restrict logins with AllowUsers, B. Disable password authentication in favour of keys, C. Remove weak algorithms from Ciphers

Limiting users, disabling password login in favour of keys, and removing weak algorithms from Ciphers all reduce risk. Allowing empty passwords or enabling the obsolete SSH-1 would weaken the server.

True or false

True or false: with PermitRootLogin prohibit-password, root can no longer log in over SSH by any method.

Show answer

Answer: False

False. prohibit-password only disables password and keyboard-interactive login for root; public key login for root is still allowed. Use no to block root entirely.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More CPSA topics in this module