Pcornel
Linux · SSH

sshd_config

Cheat sheet · https://pcornel.dk/topic.php?topic=2801

Back to the Topic

Answer

sshd_config (/etc/ssh/sshd_config and drop-ins in sshd_config.d/) controls the SSH server: port, listen address, authentication methods, root login, allowed users, ciphers, forwarding and Match blocks.

Remember

Drop-ins are read first, and the first value wins — a drop-in can override the main file. Check the effective result with sshd -T. Validate with sshd -t and reload with a second session open.

First checks

  • ssh -v user@host — client-side connection and authentication steps
  • journalctl -u ssh -u sshd -e — server log
  • sshd -T — effective server settings
  • ss -ltnp | grep :22 — sshd listening

Verify in this order

Include drop-ins and main file read → first value per option wins → Match blocks applied per connection

Where it usually breaks

First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2801

Confirmation

Confirm action

Continue?