Pcornel
Linux · SSH

SSH Server

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

Back to the Topic

Answer

The SSH server runs sshd, listens on TCP 22 (by default), presents its host keys and authenticates users according to sshd_config.

Remember

Validate before restarting: sshd -t. Keep an existing session open when changing it. Restrict who may log in (AllowUsers/AllowGroups), disable passwords for internet-facing hosts and open the port in the firewall.

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

Commands

systemctl disable --now ssh.socket

Verify in this order

sshd started → listens → presents host key → applies auth policy → starts the user session

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=2798

Confirmation

Confirm action

Continue?