Welcome to the most active Linux Forum on the web.
Go Back > Forums > Other *NIX Forums > Other *NIX
User Name
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.


  Search this Thread
Old 04-27-2005, 10:19 AM   #1
LQ Newbie
Registered: Apr 2005
Posts: 4

Rep: Reputation: 0
SSH remote command not timing out

I provide support to a bunch of remote locations through my job. Unfortunately all the locations are on a regular up and down dial up connection. When sending files/updates to the locations, we are sending the files via scp then kicking off an install script via ssh. Here is my problem:

1. The ssh command kicks off.
2. The ssh command makes the connection and begins the remote script.
3. The connection is lost to the location before it can get a return code back from the ssh/remote script.

This causes the ssh command to hang for a long time. Some times upwards of 1.5 hours. I'm wondering what controls this timeout and if there is anything I can do to force the ssh to die quicker.

I already know about the ConnectTimeout setting. This only affects making the initial connection to the location, not a drop in the middle of one.

We are using ssh version 3.8p1 on SCO 5.0.7 if that helps at all.

Thanks for any help,
Old 04-27-2005, 02:37 PM   #2
LQ Newbie
Registered: Apr 2005
Posts: 4

Original Poster
Rep: Reputation: 0
More info

I did determine it is finally timing out exactly 2 hours after the ssh command began. I can't find this setting anywhere. I checked ssh settings as well as some TCP settings and can't seem to find it. A process sitting there for 2 hours before it gives up is kind of crazy.

Any suggestions?

Old 04-27-2005, 04:01 PM   #3
Senior Member
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 54
What does "cat /proc/sys/net/ipv4/tcp_keepalive_time" say? If it's 7200 (seconds=2 hours) Try:
echo "120" > /proc/sys/net/ipv4/tcp_keepalive_time
Also check if the client uses KeepAlive and see if sshd_config has "KeepAlive yes"
Old 04-27-2005, 04:08 PM   #4
LQ Newbie
Registered: Apr 2005
Posts: 4

Original Poster
Rep: Reputation: 0
It is a little different in SCO but was set to 7200 as you mentioned. Just for anyone else using SCO, it is called tcp_keepidle and found in /etc/default/inet. I found you are supposed to change this setting using a program called inconfig and not modify the file directly. I found that about 20 minutes ago. I've changed it, just rebooted my box, and am testing it now. I'll let you know what I find out. It looks promosing by the looks of it. Hopefully that will do it.

Old 04-27-2005, 04:43 PM   #5
LQ Newbie
Registered: Apr 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Problem solved

Ok. Got it all figured out and working about as good as I want. First I changed the tcp_keepidle setting down to 300(5 minutes), the minimum SCO allows. This forces the tcp_keepalives to not even start till after 5 minutes. Then I modified the tcp_keepintrvl setting to 10. This starts the sending of a keepalive out ever 10 seconds after the previous mentioned 5 minutes is reached. The tcp_nkeep setting is at 8 which I left alone. This setting tells the tcp to only send 8 keepalives at the tcp_keepintrvl after the tcp_keepidle time is reached. So now my ssh command gives up and dies approximately 6.5 minutes instead of the 2 hours it was taking before. This suits my needs.

Thanks for all the moral support everyone. Hopefully this will help someone else along the way.

Old 04-28-2005, 06:57 AM   #6
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 266Reputation: 266Reputation: 266
Moved: More suitable in our Other *nix forum.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
remote command execute telnet with 1 command MPowers Linux - Networking 2 06-30-2005 06:31 AM
Adding users via ssh remote command enolc Linux - Software 2 05-27-2004 06:48 AM
SSH timing out/not connecting NeccoWolf Linux - Networking 2 01-26-2003 02:01 PM
remote command over ssh, password prompt linowes Linux - General 2 10-27-2002 08:22 PM > Forums > Other *NIX Forums > Other *NIX

All times are GMT -5. The time now is 06:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration