SSH Commands & ~/.ssh/config Cheat Sheet — Keys & Port Forwarding
Reference for generating Ed25519 keys, configuring shortcuts in ~/.ssh/config, copying public keys, and local/remote port forwarding tunnels.
Key Generation & Authentication
ssh-keygen -t ed25519 -C "you@example.com"
Generate modern, secure Ed25519 cryptographic key pair
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server.com
Copy your public key to remote server ~/.ssh/authorized_keys file
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_*
Set mandatory strict Linux permissions on private SSH keys
~/.ssh/config Host Aliases & Tunnels
Host prod
HostName 192.168.1.50
User ubuntu
IdentityFile ~/.ssh/prod_key
Config shortcut enabling connection with simple command: ssh prod
ssh -L 5432:localhost:5432 user@server.com
Forward local port 5432 to access private remote database through SSH tunnel
ProxyJump bastion.example.com
Route SSH traffic through a secure intermediate bastion/jump host