ConnectTimeout=2 not working for me

Vahid Moghaddasi vahid.moghaddasi at gmail.com
Fri Dec 25 08:31:40 EST 2009


Hi all,

I have somewhat a strange problem that I could not figure out, maybe someone
here can lelp.

I have a script that uses scp to distribute files to many servers, I use '-o
BatchMode=yes -o ConnectTimeout=2 options so the scp will not get stuck if
something is wrong with the remote host.

If the remote host is down (non-pingable) or sshd is down the timeout option
works and the scp continues to the next host in 2 seconds, but if the host
is up (pingable) and sshd is listening on port 22 and host is either in
trouble e.g. irresponsive then ssh connection hangs and wont every timeout.

In that case, I will have to logon to the server initiating the scp and kill
that process so the script will continue to run.

Is there any option that I can use to just disconnect the scp connection in
a given time, regardless of the scp is actually transferring file or not so
the connection wont hang for ever? The actual transfer time is about 5
seconds. I have just upgraded ssh to 5.2p1 but no help. The remote servers
platforms are AIX, Linux and Solaris and I see this behavior on all at some
point.

Thank you,


More information about the openssh-unix-dev mailing list