ssh freezes when trying to connect to some hosts
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 ?
ssh -2 -o ConnectTimeout=5
This did the trick. It's no more getting stuck