Code & computing / QUICK REFERENCE
SSH essentials
Connect safely, inspect client configuration, use keys and create tightly scoped local forwards.
Connect and diagnose
- Connect as a user
ssh alice@example.invalidVerifies the host key against known_hosts. [1]
- Choose a port
ssh -p 2222 alice@example.invalidSSH uses lowercase -p for the port. [1]
- Select a private key
ssh -i ~/.ssh/id_ed25519 alice@example.invalidThe private key must remain confidential. [1]
- Offer only configured identities
ssh -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 alice@example.invalidHelps avoid an agent offering unrelated keys. [1]
- Print effective configuration
ssh -G example.invalidShows resolved client options without connecting. [1]
- Verbose diagnostics
ssh -v alice@example.invalidRedact hostnames and identifying details before sharing. [1]
- Bound connection establishment
ssh -o ConnectTimeout=10 alice@example.invalidDoes not limit the entire session lifetime. [1]
- Noninteractive authentication
ssh -o BatchMode=yes alice@example.invalidFails instead of prompting for a password/passphrase. [1]
Keys and the agent
- Generate an Ed25519 key
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_atlasCreates new files; choose a passphrase and do not overwrite an existing key. [3][1]
- Public-key fingerprint
ssh-keygen -lf ~/.ssh/id_ed25519_atlas.pub- Load with a time limit
ssh-add -t 1h ~/.ssh/id_ed25519_atlasRemoves the identity from the agent when its lifetime expires. [4][1]
Configuration and local forwards
- Named host config
Host atlas-dev HostName example.invalid User alice Port 2222- Local loopback forward
ssh -N -L 127.0.0.1:8080:127.0.0.1:80 alice@example.invalidExposes remote port 80 only on your local loopback port 8080. [2][1]
- Fail when forwarding cannot bind
ssh -N -o ExitOnForwardFailure=yes -L 127.0.0.1:8080:127.0.0.1:80 alice@example.invalidDetects initial tunnel setup failure, not later remote-service health. [2][1]
- Client keepalive interval
ssh -o ServerAliveInterval=30 alice@example.invalid- Bound missed keepalives
ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=3 alice@example.invalid- Jump through a bastion
ssh -J alice@bastion.example.invalid alice@host.example.invalid
Reserved placement, separate from reference controls. No ad network is active.
No matching entry. Try a shorter word or clear the search to see the complete sheet.
Sources
cheatsheetatlas.com/sheets/ssh/ · Updated 2026-10-19 · OpenSSH client · POSIX shell examples