Pcornel
Linux · SSH

SSH Client

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

Back to the Topic

Answer

The SSH client (ssh) connects to a server, verifies its host key against known_hosts, authenticates you and runs a shell or command. It reads ~/.ssh/config for per-host settings.

Remember

Use ssh -v (or -vvv) to see each step. Use -i or IdentityFile for a specific key and ssh-agent to avoid retyping passphrases. Too many keys in the agent can exceed MaxAuthTries — set IdentitiesOnly yes.

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

sudo
journalctl -f

Verify in this order

client reads config → TCP connect → host key check → key/password authentication → 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=2797

Confirmation

Confirm action

Continue?