Is there a more direct way to exit an OpenSSH control master process and delete its socket file than with the help of the programs
fuser and without knowing the destination host (connection details) as suggested by the accepted answer of this question? I thought of something like this along the lines of:
$ ssh -O exit -S ~/.ssh/7eb92b0827f3e8e1e8591fb3d1a5cd1b94b758cb.socket
I'm asking because I'm looking for a scriptable way to exit every open control master connection each time when I log out of my user account. Not doing so causes my sytemd-powered openSUSE computer to wait for a timeout of two minutes until it forcefully terminates the still open control master connection powering off eventually.
Unfortunately OpenSSH's client program
ssh requires the destination host and the
ControlPath file name pattern in order to deduce the actual file path to the socket file. I on the contrary thought of the more direct method of providing the concrete socket file via the program's
-S ctl_path option.
In the global section of my system-wide OpenSSH client config file I configured OpenSSH's connection multiplexing feature as follows:
ControlMaster auto ControlPath ~/.ssh/%C.socket ControlPersist 30m
Please note that I want to keep the file name pattern for socket files, i.e. hashing the token string
%l%h%p%r with the token