ssh controlmaster connections

Memo/Linux/ssh - DEX Lab

This works for me using just the socket file for the control master:

$ ssh -o ControlPath=~/.ssh/ -O check 

Example
Here's an example where I've already established a connection to a remote server:

$ ssh -o ControlPath=~/.ssh/master-57db26a0499dfd881986e23a2e4dd5c5c63e26c2 -O check blah
Master running (pid=89228)

And with it disconnected:

$ ssh -o ControlPath=~/.ssh/master-66496a62823573e4760469df70e57ce4c15afd74 -O check blah
Control socket connect(/Users/user1/.ssh/master-66496a62823573e4760469df70e57ce4c15afd74): No such file or directory

If it were still connected, this would force it to exit immediately:

$ ssh -o ControlPath=~/.ssh/master-66496a62823573e4760469df70e57ce4c15afd74 -O exit blah
Exit request sent.

How to close (kill) ssh ControlMaster connections manually - Unix & Linux Stack Exchange