When I try to ssh to particular machine/s in a list, The SSH command happens to be freezing. I tried out setting ssh timeout. But then also it's freezes even after the timeout.

In verbose mode :

OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to x358.x.server.com [10.x.x.x] port 22.
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug1: identity file /export/home/sqlrpt/.ssh/identity type -1
debug1: identity file /export/home/sqlrpt/.ssh/id_rsa type -1
debug1: identity file /export/home/sqlrpt/.ssh/id_dsa type 2

At this point it freezes.

A work around I thought was to create a child process for each ssh calls and if the process doesn't respond after a timeout - Kill it. But are there any less complex ways, so that I can accommodate it in a shell script itself rather than going for a C/C++ program ?

  • 2
    Try running the ssh command with -vv or even -vvv to increase verbosity - you might get more information that way. – D_Bye Mar 8 '12 at 10:35
  • Programming question or admin question? – glglgl Mar 8 '12 at 10:37
  • Why such ancient versions of OpenSSH & OpenSSL? – Spiff Mar 8 '12 at 12:09
  • Can't help it much as they are managed by a different colo. and the only way is just to go with this :| – NS Gopikrishnan Mar 8 '12 at 12:44
ssh -2 -o ConnectTimeout=5

This did the trick. It's no more getting stuck

| improve this answer | |

probably, you found this bug https://bugzilla.redhat.com/show_bug.cgi?id=143316
it was duplicated here https://bugzilla.redhat.com/show_bug.cgi?id=133884 , and there is a workaround for it

echo 0 > /proc/sys/net/ipv4/tcp_default_win_scale
| improve this answer | |
  • can you make it more clear? What really is the work around ? – NS Gopikrishnan Mar 27 '12 at 8:16

I had this same kind of annoying problem with openSuse 11.4 (x86_64) (kernel, SSH-version: OpenSSH_5.8p1, OpenSSL 1.0.0c 2 Dec 2010.

echo 0 > /proc/sys/net/ipv4/tcp_window_scaling

Did the trick and problem is now solved.

| improve this answer | |

I think the problem is with the host's internet.This has happened to me several times.Right before ssh turn the hosts internet off and then back on.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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