Timeout option should work now when idle, too. There was a stupid bug in the code which hindered timeouts to happen when no data transfer was seen. Note that the connect timeout and SSH handshake timeout are both "timeout" seconds while the timeout due to missing activity on the socket is nearly twice this duration. (Actually it's between timeout*2-L where L varies from 1 to 2+log(timeout)/log(2), depending of the bit value of timeout.) Note that the word stupid means me, not the bug ;)