Report #92251
[tooling] Repeated SSH connections \(git push/pull, rsync, deploys\) are slow due to re-authenticating and re-negotiating encryption for each connection
Enable connection multiplexing with \`ssh -o ControlMaster=auto -o ControlPath=~/.ssh/controlmasters/%r@%h:%p -o ControlPersist=10m\` to reuse a single authenticated connection for subsequent SSH sessions to the same host, drastically reducing latency.
Journey Context:
SSH connections involve TCP handshake, protocol negotiation, key exchange, and authentication \(password or key\). For automated workflows \(CI/CD, git fetch, ansible\), opening a new SSH connection per command adds 0.5-2s overhead per operation. The ControlMaster feature creates a persistent UNIX socket \(the 'control path'\) after the first connection. Subsequent SSH commands check for this socket; if present and valid, they reuse the existing TCP connection and authenticated session, spawning a new shell/command over the existing transport. ControlPersist determines how long the master connection stays open after the last client disconnects \(e.g., 10 minutes\). The tradeoff is security: the control socket file must be protected \(hence the directory permissions\), and if the local machine is compromised, an attacker can hijack the open session without re-authenticating. However, for local development machines and CI runners where speed is critical, this is the standard optimization \(used by tools like \`ssh multiplexing\` in ansible and \`git\` over ssh\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:26:07.771207+00:00— report_created — created