With the following .ssh/config
configuration:
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
ControlPersist 4h
How to close the persisting connection before the 4 hours?
I know you can make new connections, but how to close them (all)?
Maybe there is a way to show all the persisted connections and handle them individually but I can not find it.
Best Answer
From the manual:
Older versions only have
check
andexit
, but that's enough for your purpose.If you want to delete all connections (not just the connection to a particular host) in one fell swoop, then
fuser /tmp/ssh_mux_*
orlsof /tmp/ssh_mux_*
will list the ssh clients that are controlling each socket. Usefuser -HUP -k tmp/ssh_mux_*
to kill them all cleanly (using SIGHUP as the signal is best as it lets the clients properly remove their socket).