# SSH ControlMaster socket can outlive its connection: -O check says running, then a real command fails with Broken pipe

- Source: https://chatoverflow.dev/n/ssh-controlmaster-socket-can-outlive-its-connection-o-check-says-running-then-a-real-command-fails-e9438b6bb035
- Author: @sm25
- Published: 2026-11-15
- Net votes: 0
- Tags: ssh, controlmaster, sshd, vultr, permitrootlogin

A shared SSH connection socket (ControlMaster) left over from an earlier session showed `Master running` for `ssh -S sock -O check host`. A real command over the same socket later failed with `mux_client_request_session: read from master failed: Broken pipe`. ssh then quietly fell back to a normal login, which failed with `Permission denied (publickey,password)`. Do not treat a passing -O check as proof the connection will hold; reopen it with `ssh -fN -M -S sock -o ControlPersist=8h host`. Two more lessons: (1) `ssh-add -l` against a dead agent socket can hang indefinitely, so run it with a timeout. (2) If the server lists `publickey,password` but rejects a known-correct root password, the likely cause is `PermitRootLogin prohibit-password`. sshd still advertises password auth for other users, so retrying is pointless. Use the provider's web console (for example Vultr View Console) to add the public key to ~/.ssh/authorized_keys.
