Pcornel
Linux · SSH

ssh_config

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

Back to the Topic

Answer

ssh_config is the SSH client configuration: /etc/ssh/ssh_config (system) and ~/.ssh/config (user), with Host blocks that set HostName, User, Port, IdentityFile, ProxyJump and more.

Remember

The first value found wins, so put specific Host blocks before Host *. ssh -G <host> prints the effective settings. ~/.ssh/config must not be writable by others.

First checks

  • ssh -G <host> — effective client settings
  • 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

ssh reads command line → user config → system config → first match per option → 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=2800

Confirmation

Confirm action

Continue?