Secure Shell Protocol — Encrypted Remote Access Since 1995
| Feature | SSH-1 | SSH-2 |
|---|---|---|
| Status | Deprecated/Insecure | Current standard |
| MAC | CRC-32 (broken) | HMAC-SHA1/SHA2/SHA3 |
| Key exchange | RSA only | DH, ECDH, curve25519 |
| Channels | Single channel | Multiplexed channels |
| Interoperability | Protocol incompatible | RFC standardized |
| SFTP | No | Yes |
| Port forwarding | Limited | Full support |
| Vulnerabilities | Multiple critical CVEs | No known protocol flaws |
| Command | Description | Example |
|---|---|---|
| ssh user@host | Connect to remote host as user | ssh alice@192.168.1.10 |
| ssh -p PORT | Connect on non-standard port | ssh -p 2222 user@host |
| ssh -i keyfile | Use specific private key file | ssh -i ~/.ssh/id_ed25519 user@host |
| ssh -L local:host:remote | Local port forwarding (tunnel remote port to local) | ssh -L 8080:localhost:80 user@host |
| ssh -R remote:host:local | Remote port forwarding (expose local port on remote) | ssh -R 9090:localhost:3000 user@host |
| ssh -D port | Dynamic SOCKS5 proxy on local port | ssh -D 1080 user@host |
| ssh -J jump user@target | Jump through bastion/proxy host | ssh -J bastion.co user@10.0.0.5 |
| ssh -N | No remote command — tunnel only, no shell | ssh -N -L 5432:db:5432 user@host |
| ssh -f | Go to background before command execution | ssh -fN -L 8080:host:80 user@host |
| ssh -v / -vvv | Verbose debug output (up to 3 levels) | ssh -vvv user@host 2>&1 | head -50 |
| ssh -t cmd | Force pseudo-TTY allocation for remote command | ssh -t user@host sudo bash |
| ssh-keygen -t ed25519 | Generate Ed25519 keypair (recommended) | ssh-keygen -t ed25519 -C "me@host" |
| ssh-keygen -t rsa -b 4096 | Generate RSA-4096 keypair (legacy compat) | ssh-keygen -t rsa -b 4096 -C "key" |
| ssh-keygen -p -f key | Change passphrase on existing key | ssh-keygen -p -f ~/.ssh/id_ed25519 |
| ssh-keygen -l -f key | Show key fingerprint | ssh-keygen -l -f ~/.ssh/id_ed25519.pub |
| ssh-keygen -R host | Remove host key from known_hosts | ssh-keygen -R 192.168.1.10 |
| ssh-copy-id user@host | Copy public key to remote authorized_keys | ssh-copy-id -i ~/.ssh/id_ed25519.pub user@host |
| ssh-agent bash | Start ssh-agent and spawn shell | eval "$(ssh-agent -s)" |
| ssh-add | Add private key to running agent | ssh-add ~/.ssh/id_ed25519 |
| ssh-add -l | List keys loaded in agent | ssh-add -l -E sha256 |
| scp src user@host:dst | Secure copy file (uses SSH transport) | scp file.tar.gz user@host:/tmp/ |
| scp -r dir user@host:dst | Recursively copy directory | scp -r ./project user@host:~/ |
| sftp user@host | Interactive SSH file transfer session | sftp -i key user@host |
| rsync -e ssh | Rsync over SSH (efficient sync) | rsync -avz -e ssh ./src user@host:dst/ |
| ssh-keyscan -H host | Scan and collect host public keys | ssh-keyscan -H github.com >> known_hosts |
| ssh -o StrictHostKeyChecking=no | Skip host key verification (automation only) | ssh -o StrictHostKeyChecking=no user@host |
| File | Description |
|---|---|
| ~/.ssh/id_ed25519 | Private key — NEVER share, chmod 600 |
| ~/.ssh/id_ed25519.pub | Public key — safe to copy to servers |
| ~/.ssh/authorized_keys | Trusted public keys on the server, chmod 600 |
| ~/.ssh/known_hosts | Hashed fingerprints of known servers |
| ~/.ssh/config | Client-side connection aliases and settings |
| /etc/ssh/ssh_host_*_key | Server host keys (private), root-owned 600 |
| /etc/ssh/sshd_config | SSH server daemon configuration |
A SHA256 fingerprint uniquely identifies a host key. Verify on first connection to prevent MITM attacks:
| Host | Alias for connection block |
| HostName | Actual hostname or IP |
| User | Username for connection |
| Port | Remote SSH port (default 22) |
| IdentityFile | Path to private key |
| ProxyJump | Bastion host to jump through |
| ServerAliveInterval | Keepalive interval in seconds |
| ServerAliveCountMax | Max missed keepalives before disconnect |
| Compression | Enable gzip compression |
| ForwardAgent | Forward ssh-agent to remote host |
| StrictHostKeyChecking | yes / no / accept-new |
| ControlMaster | Enable connection multiplexing |
| ControlPath | Socket path for shared connections |
| Port | Listen port (default 22) |
| PermitRootLogin | no / prohibit-password / yes |
| PasswordAuthentication | no (disable) / yes |
| PubkeyAuthentication | yes (enable key auth) |
| AuthorizedKeysFile | Path to authorized_keys |
| AllowUsers | Whitelist specific users |
| AllowGroups | Whitelist specific groups |
| MaxAuthTries | Max auth attempts per connection |
| MaxSessions | Max open sessions per connection |
| ClientAliveInterval | Keepalive interval to client |
| ClientAliveCountMax | Max missed keepalives |
| X11Forwarding | Enable/disable X11 forwarding |
| UsePAM | Enable PAM for auth modules |
| Banner | Display file before login prompt |
| Subsystem sftp | SFTP subsystem path |
sftp and rsync for all file transfer work.sk-ecdsa and sk-ed25519 key types — enabling phishing-resistant SSH authentication with YubiKeys and similar devices. SSH certificates (CA-signed) become the standard for enterprise-scale key management, replacing per-host authorized_keys sprawl.| Protocol | Port | Encryption | Auth | Status |
|---|---|---|---|---|
| Telnet | 23 | None — plaintext | Password in plaintext | Obsolete |
| rlogin | 513 | None — plaintext | Trusted host + username | Obsolete |
| rsh | 514 | None — plaintext | No real authentication | Obsolete |
| SSH | 22 | Strong — AES, ChaCha20 | Key-based or password over TLS | Current standard |