SSH Config Power Tricks
.ssh/config tricks for managing many hosts.
Host aliases
SSH config power is the discipline of using ~/.ssh/config to make SSH workflows efficient. The team's daily SSH operations become fast; the discipline pays off in productivity.
What host aliases provide:
- Host prod-1, Hostname 10.0.1.1, User admin.: The basic alias. The Host directive defines the alias; Hostname is the actual address; User is the SSH user. Together they make a friendly name.
- ssh prod-1 instead of full hostname.: The engineer types the alias; SSH expands to the full configuration. The shorthand is faster; the alias is memorable.
- Per-environment naming.: The team's naming convention applies. prod-N for production; staging-N for staging; the consistency supports muscle memory.
- Wildcard hosts.: Host prod-* applies to many hosts. Common configuration (User, IdentityFile, port) applies once; per-host details override; the discipline is DRY.
- Hostname tokens.: Hostname can use tokens like %h. ssh prod-1 with Hostname prod-1.internal.example.com expands automatically; the discipline scales.
Host aliases are the foundation. Engineers' productivity is meaningfully improved.
JumpHost
JumpHost (or ProxyJump) is the discipline of routing SSH through a bastion. The configuration is in ~/.ssh/config; the SSH session goes through the bastion automatically.
- ProxyJump bastion through bastion.: The ProxyJump directive specifies the bastion. SSH connects to the bastion first; then through the bastion to the target; the routing is automatic.
- Cleaner than -J flag.: The configured ProxyJump is cleaner than the -J flag on every command. The team's regular commands work without flags; the discipline is built in.
- Multi-hop bastions.: ProxyJump supports chaining bastions. ssh through bastion1 through bastion2 to target. Some environments require multi-hop; the configuration handles it.
- Per-target bastions.: Different targets can use different bastions. The configuration handles the routing; the engineer types only the target alias.
- Avoid agent forwarding security issues.: ProxyJump is preferred over agent forwarding. Agent forwarding allows the bastion to use the engineer's keys; ProxyJump does not; the security model is better.
JumpHost configuration matches the team's bastion architecture. The discipline is in the config.
Control sockets
Control sockets allow SSH to share a connection across multiple sessions. Subsequent connections to the same host are instant; the workflow is faster.
- ControlMaster auto plus ControlPath shares connections.: The directives enable connection sharing. The first SSH to a host establishes the connection; subsequent SSH to the same host reuses it.
- Subsequent ssh to same host is instant.: The reuse is fast. New SSH sessions skip the connection setup; the workflow is interactive; the discipline is productivity.
- Persistent connections.: ControlPersist keeps the connection alive after the original session ends. The connection can be reused for some duration; the workflow continues to be fast.
- scp and similar benefit.: Beyond ssh, scp and rsync over SSH benefit. They reuse the connection; transfers are faster; the discipline scales.
- Watch for stuck connections.: Sometimes connections get stuck. The discipline includes recognizing and clearing them; ssh -O exit hostname closes the persistent connection.
SSH config power is one of those engineer-productivity disciplines that pays off across many SSH operations. Nova AI Ops integrates with infrastructure observability, complementing SSH-driven access with cluster-wide visibility.