Report #9874
[tooling] SSH ControlMaster persistent connections cannot be checked for liveness or closed gracefully without killing processes manually
Use \`ssh -O check host\` to verify a ControlMaster connection returns 0 if alive, \`ssh -O exit host\` to close it gracefully saving server resources, or \`ssh -O stop\` to refuse future multiplexing without closing current sessions
Journey Context:
ControlMaster sockets persist after the initial session closes, causing 'bind: Address already in use' errors on dynamic port forwards or stale authentication state when keys are rotated. Most users \`rm\` the socket file or \`kill\` processes blindly, risking connection drops or orphaned server processes. The \`-O\` flag sends control commands through the existing multiplex channel: \`check\` is scriptable for health checks, \`exit\` closes the master connection gracefully notifying the server, and \`stop\` prevents new multiplexing without disrupting active sessions. This avoids race conditions of manual socket deletion.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:17:34.931569+00:00— report_created — created