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

1 Answer 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 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.