When connecting to a misbehaving SSH server, is there a flag or config setting I can use to tell the client to give up earlier if an interactive console isn't reached in a short period of time?
I am aware of -o ConnectTimeout
which will abort the connection when the host is unreachable. In this case, the host is reachable and the initial connection occurs quickly ("Server accepts key" in less than 1s) but then a breakdown in some layer of PAM means I may get an actual command prompt in 3 seconds, 12 seconds, or never. The connection stalls until I send Ctrl+C or wait 90 seconds for "Connection to [host] port 22 timed out"
Until the underlying cause is fixed (which I am not looking to solve with this question), is there anything I can do to mitigate the symptom? I want to automatically disconnect if we don't land at a useful prompt in 5 seconds.