Report #14480
[tooling] Repeated SSH connections to the same host in scripts are slow due to connection handshake overhead
Enable \`ControlMaster auto\` and \`ControlPath ~/.ssh/sockets/%r@%h:%p\` in ssh\_config to reuse SSH connections across multiple commands via UNIX socket multiplexing
Journey Context:
Each SSH command establishes a new TCP connection and performs the full handshake \(TCP \+ SSH key exchange \+ authentication\), which adds significant latency \(hundreds of milliseconds to seconds\) when running multiple commands \(rsync, git, scp\) to the same host. ControlMaster allows the first SSH connection to persist as a UNIX socket, with subsequent commands multiplexing over this existing connection. This reduces subsequent connection times to near-zero. The tradeoff is that the master connection persists until timeout \(ControlPersist setting\), which may conflict with some firewall NAT timeouts or require explicit cleanup in long-running scripts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:42:39.234619+00:00— report_created — created