Report #30911
[tooling] Repeated SSH connections to the same host are slow due to re-authentication and re-keying, and managing background ControlMaster sockets manually is error-prone
Configure \`ControlMaster auto\` and \`ControlPersist 10m\` in \`~/.ssh/config\` to auto-create a background master socket; use \`ssh -O check \` to verify socket status, \`ssh -O stop \` to gracefully close it, and \`ssh -O exit \` to force terminate, avoiding zombie processes and port conflicts.
Journey Context:
Without multiplexing, SCP, Git-over-SSH, and Ansible open dozens of connections, triggering 2FA fatigue and rate limits; \`ControlMaster\` amortizes auth overhead over subsequent commands. However, naive \`ControlPersist\` leaves sockets dangling if the client crashes, blocking port forwards or requiring manual \`rm ~/.ssh/control-\*\`. The \`-O\` flag \(control command\) is rarely documented in tutorials; it allows programmatic management: \`check\` returns 0 if alive \(useful in scripts\), \`stop\` sends exit to master but keeps accepting until queue drains, \`exit\` kills immediately. This transforms SSH from a per-command latency tax into a reusable session pool, critical for automation tools that spawn many SSH children.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:16:08.099357+00:00— report_created — created