SSH multiplex timeout configuration

I use ssh multiplexing, from time to time my hosts are rebooted or not reachable but the ControlMaster is still active and keeps the connection details in the ControlPath file. When I try to connect in such a case there is a large timeout until ssh detects the connection is not valid any more and establishes a new master connection. Is there a way to shorten this timeout?

Currently I use a config like this:

ControlPath /tmp/ssh-%r@%h:%p
ControlMaster=auto
ControlPersist=600

Solution 1:

The closest I can come to solving this is with scripting. I don't believe that ssh currently has any ctl_cmds that operate on the timeout for the controlmaster

ssh $Host -O check blah 2> /dev/null && (timeout 3 ssh $Host exit || ssh $Host -O exit ) ; ssh $Host