SSH Config Tips You Should Be Using
Your ~/.ssh/config can save you from typing the same connection details repeatedly.
Key Insights
- Host aliases in ~/.ssh/config replace repetitive command-line flags with simple names like
ssh prod - ProxyJump handles bastion/jump host connections in a single command without manual tunneling
- Connection multiplexing (ControlMaster) reuses existing connections for near-instant subsequent logins
If you’re still typing full SSH commands with usernames, ports, and key paths, you’re working too hard. The SSH config file handles all of this.
Basic Host Configuration
# ~/.ssh/config
Host prod
HostName 203.0.113.50
User deploy
Port 2222
IdentityFile ~/.ssh/prod_ed25519
Host staging
HostName 198.51.100.10
User deploy
IdentityFile ~/.ssh/staging_ed25519
Now ssh prod is all you need.
Jump Hosts
Host bastion
HostName 203.0.113.1
User admin
Host internal-db
HostName 10.0.1.50
User dbadmin
ProxyJump bastion
Wildcard Patterns
Host *.prod
User deploy
IdentityFile ~/.ssh/prod_ed25519
StrictHostKeyChecking yes
Host *.dev
User developer
StrictHostKeyChecking no
Keep Connections Alive
Host *
ServerAliveInterval 60
ServerAliveCountMax 3
AddKeysToAgent yes
Multiplexing
Reuse existing connections for faster subsequent logins:
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
Create the sockets directory: mkdir -p ~/.ssh/sockets
These configurations compound — once set up, SSH becomes nearly frictionless.