- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- SSH Hangup on client if server is down
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2005 08:24 PM
04-12-2005 08:24 PM
SSH Hangup on client if server is down
We are using ssh/scp in scripts to browse to different servers. When we try to do ssh/scp from client to server(which is down), client just hangs and does not return causing whole script to hang.
We want ssh/scp to come out after waiting for some amount of time(e.g. 15 secs) and return non zero value.
Is there any solution(like some parameter in sshd_config file) which can prevent this hang?
Tried using TMOUT variable
e.g.
$TMOUT=1 ; ssh
But it did not work.
Help please !!!!
Thanks in advance.
Regards,
Shailesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2005 11:57 PM
04-12-2005 11:57 PM
Re: SSH Hangup on client if server is down
Set "ConnectTimeout" directive to value 15 in ssh client configuration file (ssh_config)
This will enforce your ssh client to stop connecting to the server when timeout is reached.
You will see a message as below for an example command
# ssh -l ssh lan.sun.com -o'ConnectTimeout 1' date
ssh: connect to host lan.sun.com port 22: Connection timed out
All The Best !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2005 12:43 AM
04-13-2005 12:43 AM
Re: SSH Hangup on client if server is down
Thanks for the reply.
Tried doing that, but it seems like ConnectTimeout is not supported option with my SSH version
#ssh
command-line: line 0: Bad configuration option: ConnectTimeout
we are using following version of SSH -
OpenSSH_3.4p1, SSH protocols 1.5/2.0, OpenSSL
SSH Version Sun_SSH_1.0.1 on another machine
Checked man ssh_config, it has one more parameter ConnectionAttempts [Specifies the number of tries (one per second) to make before exiting. The argument must be an integer. This may be useful in scripts if the connection sometimes fails. The default is 1.]
Tried that too.
ssh -o'ConnectionAttempts 1'
But it hangs indefinitely.
What else could be the problem?
Regards,
Shailesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 12:13 AM
04-14-2005 12:13 AM
Re: SSH Hangup on client if server is down
Can you please let us know the version of ssh you are using. the sshd_config is the file which needs modification. And what Mike did was right.
Thanks
Pratyush
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 12:44 AM
04-14-2005 12:44 AM
Re: SSH Hangup on client if server is down
Having said that, even 3.4p1 with ConnectionAttempts set to 1, should timeout after about 75 seconds (TCP timeout?).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 04:21 AM
04-14-2005 04:21 AM
Re: SSH Hangup on client if server is down
It would be best to use an applications built-in timout mechanism though as altering tcp_ip_abort_cinterval will affect _all_ applications.
(Yes, that is "cinterval" and not "interval" - tcp_ip_abort_interval is for established connections).
You might consider taking a tusc trace of the client to see if perhaps it is making more than one connect() call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 05:43 AM
04-14-2005 05:43 AM
Re: SSH Hangup on client if server is down
Thanks a lot for your suggestion regarding Old version of SSH. We are looking to upgarde it.
According to last line in your reply, I checked whether sessions times out after 75 seconds. They do timeout wherever OpenSSH is installed. But on other machines(where we are using SSH Version Sun_SSH_1.0.1) on Solaris, it does not time out and just hangs. Is this a problem with Sun version of SSH? Here we are using is is "SunOS 5.9 Generic_117171-01 sun4u sparc SUNW,Sun-Fire-V240"
Why ConnectionAttempts option does not work with OpenSSH? Is this a bug with version OpenSSH_3.4p1 or there is some other system level problem? Here we are running on "SunOS 5.8 Generic_117350-06 sun4u sparc SUNW,Sun-Fire-880"
Thanks and Regards,
Shailesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 06:10 AM
04-14-2005 06:10 AM
Re: SSH Hangup on client if server is down
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 12:21 PM
04-14-2005 12:21 PM
Re: SSH Hangup on client if server is down
If you install newer version of ssh, you will be able to set ConnectTimeout to use instead of system TCP timeout.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 11:52 PM
04-14-2005 11:52 PM
Re: SSH Hangup on client if server is down
Following is the respective outputs of "date ; ssh -p 922 -v -v -v linuxdba ; date" on machines where OpenSSH and Sun_SSH are installed -
Open_SSH
-----------------------------------------------------------------------------
$ssh -V
OpenSSH_3.4p1, SSH protocols 1.5/2.0, OpenSSL 0x0090604f
$ date ; ssh -p 922 -v -v -v
Fri Apr 15 01:25:16 EDT 2005
OpenSSH_3.4p1, SSH protocols 1.5/2.0, OpenSSL 0x0090604f
debug1: Reading configuration data /usr/local/etc/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to
ssh: connect to address
Fri Apr 15 01:29:01 EDT 2005
-----------------------------------------------------------------------------
Sun_SSH
-----------------------------------------------------------------------------
$ date ; ssh -p
Fri Apr 15 01:24:08 EDT 2005
SSH Version Sun_SSH_1.0.1, protocol versions 1.5/2.0.
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: getuid 100 geteuid 100 anon 1
debug1: Connecting to
debug1: connect: Connection timed out
debug1: Trying again...
debug1: Connecting to
debug1: connect: Connection timed out
debug1: Trying again...
debug1: Connecting to
debug1: connect: Connection timed out
debug1: Trying again...
debug1: Connecting to
debug1: connect: Connection timed out
Secure connection to
Using rsh. WARNING: Connection will not be encrypted.
/usr/bin/rsh
Fri Apr 15 01:42:55 EDT 2005
-----------------------------------------------------------------------------
On Sun machine is did come out, but after long time, after multiple tries. Is this the default behaviour (To try multiple times) for Sun_SSH? Or some parameter setting in ssh_config which is given below. Do we need "FallBackToRsh yes" in ssh_config file?
Contents of /etc/ssh/ssh_config on Sun machines are -
Host *
Port 922
ForwardAgent no
ForwardX11 yes
# PubkeyAuthentication yes
# PasswordAuthentication yes
FallBackToRsh yes
# UseRsh no
BatchMode no
CheckHostIP no
# StrictHostKeyChecking ask
# EscapeChar ~
Thanks and Regards,
Shailesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2005 01:06 AM
04-15-2005 01:06 AM
Re: SSH Hangup on client if server is down
So modify /etc/ssh/ssh_config as follows
ConnectionAttempts 1
FallBackToRsh no