Pcornel
Linux · SSH

sshd

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

Back to the Topic

Answer

sshd is the OpenSSH server daemon (service sshd on RHEL, ssh on Debian/Ubuntu). It may also be started by socket activation (ssh.socket) on newer Ubuntu releases.

Remember

A config error stops sshd from starting — sshd -t shows it. On Ubuntu with ssh.socket, the port is set in the socket unit, not only in sshd_config. Reload with systemctl reload sshd to keep sessions.

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 status ssh
systemctl reload ssh
systemctl restart ssh
journalctl -u ssh -b
ss -tlnp 'sport = :22'
systemctl status ssh.socket

Verify in this order

unit (service or socket) starts sshd → config parsed → host keys loaded → listening

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

Confirmation

Confirm action

Continue?