ssh freezes when trying to connect to some hosts

6,821
ssh -2 -o ConnectTimeout=5

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

Share:
6,821

Related videos on Youtube

Wattholm
Author by

Wattholm

Updated on September 18, 2022

Comments

  • Wattholm
    Wattholm over 1 year

    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 ?

    • D_Bye
      D_Bye about 12 years
      Try running the ssh command with -vv or even -vvv to increase verbosity - you might get more information that way.
    • glglgl
      glglgl about 12 years
      Programming question or admin question?
    • Spiff
      Spiff about 12 years
      Why such ancient versions of OpenSSH & OpenSSL?
    • Wattholm
      Wattholm about 12 years
      Can't help it much as they are managed by a different colo. and the only way is just to go with this :|
  • Wattholm
    Wattholm about 12 years
    can you make it more clear? What really is the work around ?