Question about documentation for ConnectTimeout

Darren Tucker dtucker at
Wed Jan 7 14:32:21 EST 2009

Garrett Cooper wrote:
> Hello OpenSSH folks,
>     This was a really minor knit, but I noted while I was developing a
> pexpect module for ssh that setting ConnectTimeout to 0 in the options
> to ssh sets the login timeout to infinite time.
>     I was wondering whether or not this was a documentation bug and/or
> potential clarification that could to be made, or if this was a
> software bug that needs to be fixed. I don't see much point behind
> infinite connect time, but then again, I'm just one end-user in a sea
> of many users.

The code in question is in sshconnect.c:timeout_connect:

         if (*timeoutp <= 0) {
                 result = connect(sockfd, serv_addr, addrlen);
                 goto done;

so if ConnectTimeout=0 it doesn't explicitly make the timeout infinite, 
but merely falls back to whatever the operating system defaults to for 
connect(2).  This should be constrained by the TCP maximum segment 
lifetime, and may be a couple of minutes (OpenBSD, for example, times 
out connects at 75 seconds, Linux at ~3 minutes).

Darren Tucker (dtucker at
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
     Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list