SSH Cheatsheet - SSH Connection & Configuration Command Reference
For developers and ops who want passwordless login, hop through bastion hosts into the internal network, or map a remote port to localhost for debugging. The value of SSH lies in reusing keys and config: pin frequently used Hosts, jump hosts, and port forwards into ~/.ssh/config instead of retyping long argument sets each time. By the end you can generate and correctly permission a key pair for passwordless login, hop through bastions with ProxyJump, and expose a remote service on localhost with -L for debugging.
Connection & Auth 5
ssh user@hostssh -p 2222 user@hostssh -i ~/.ssh/id_ed25519 user@hostssh -vvv user@hostssh -o ConnectTimeout=5 user@hostKey Management 5
ssh-keygen -t ed25519 -C "tom@example.com"ssh-keygen -t rsa -b 4096 -C "tom@example.com"ssh-copy-id -i ~/.ssh/id_ed25519.pub user@hostssh-keygen -lf ~/.ssh/id_ed25519.pubeval $(ssh-agent) && ssh-add ~/.ssh/id_ed25519Config File ~/.ssh/config 6
Host prodHostName 1.2.3.4User deployIdentityFile ~/.ssh/id_ed25519ProxyJump bastionLocalForward 8080 127.0.0.1:80Port Forwarding & Proxy 5
ssh -L 8080:127.0.0.1:80 user@hostssh -R 9090:127.0.0.1:80 user@hostssh -D 1080 user@hostssh -N -L 8080:127.0.0.1:80 user@hostssh -J bastion user@internalTips
- Use ssh-copy-id for passwordless login — manually editing authorized_keys is error-prone with permissions and format.
- ~/.ssh directory must be 700, private keys must be 600 — SSH refuses keys with loose permissions.
- Add -N -f to run port forwarding in the background, but remember to stop with ssh -O exit or kill to avoid lingering processes.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us