A local OpenSSH multiplexing master can keep a control socket open after the first login has closed, so later ssh commands may still reuse the same authenticated connection. When a host should stop accepting shared sessions before testing login changes, switching identities, or handing the client account to another operator, the local master needs a controlled shutdown.
The ssh -O stop control command talks to the master through the configured ControlPath and tells it to stop listening for new multiplexed clients. Existing sessions can finish, while future ssh commands that match the host must open a fresh connection or create a new master if ControlMaster auto remains configured.
The control command must use the same host alias, user, port, and client configuration that created the master. The stop command affects only the current local control socket; use ssh -O exit instead only when active shells, port forwards, or file transfers using that master should be closed immediately.
Related: How to configure SSH multiplexing
Related: How to check SSH multiplexing session status
Related: How to speed up SSH authentication
$ ssh -O check host-mux Master running (pid=85)
Replace host-mux with the alias or destination used by the multiplexed sessions. A missing socket means there is no current master to stop.
$ ssh -O stop host-mux Stop listening request sent.
ssh -O stop does not forcibly close existing sessions. Use ssh -O exit host-mux instead only when those sessions should be interrupted.
$ ssh -O check host-mux Control socket connect(/home/user/.ssh/muxmasters/c0657b039ebf877ae442037457ed8bc9ce0ffd90): No such file or directory
The missing control socket is expected after stop because the master no longer accepts new multiplexing requests.
$ ls -l ~/.ssh/muxmasters total 0
If ControlPath points somewhere else, list that directory instead. Stopping the current master does not remove ControlMaster or ControlPersist from ~/.ssh/config.