SSH Config Aliases for a Small Fleet
Replace long SSH commands with readable host aliases while keeping usernames, ports, keys, and jump hosts explicit.

Photo: Unsplash.
Long SSH commands are easy to mistype and difficult to review:
ssh -p 2222 -i ~/.ssh/id_ed25519_ops [email protected]
OpenSSH can store these connection details in ~/.ssh/config:
Host blog-prod
HostName 203.0.113.24
User deploy
Port 2222
IdentityFile ~/.ssh/id_ed25519_ops
IdentitiesOnly yes
The connection becomes:
ssh blog-prod
The alias also works with tools that use SSH underneath:
scp backup.tar.zst blog-prod:/srv/backups/
rsync -av ./dist/ blog-prod:/srv/www/
For a host reachable only through a bastion, keep both entries readable:
Host bastion
HostName bastion.example.net
User ops
IdentityFile ~/.ssh/id_ed25519_ops
Host app-private
HostName 10.20.0.15
User deploy
ProxyJump bastion
Use narrow patterns. A global Host * block is useful for harmless defaults such as ServerAliveInterval, but avoid assigning one identity or user to every destination unless that is truly intended.
Protect the file and private keys from other local users:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/config ~/.ssh/id_ed25519_ops
Before relying on an alias, inspect the effective configuration:
ssh -G blog-prod | less
This expands values inherited from wildcard blocks and makes unexpected usernames, ports, or proxy settings visible without opening a connection.
Aliases do not replace an inventory or secrets manager. For a handful of servers, however, they remove repeated command-line details and make the destination obvious before you press Enter.
