ssh stalls?

bbloke

Registered
Just a quick query to see if anyone else has experienced something like this...

I've noticed that if I use Terminal to ssh into Unix servers at work from home, if I do not use the connection for a few minutes that Terminal window no longer responds to input. I have to open another window and kill the ssh process, and then the Terminal window responds again. I don't think this is related to my hardware (eg my router; Netgear DG814). Also, when at work these ssh connections do not stall.

Has anyone else seen something like this? Is it a Terminal bug?
 
I have had the same problem, only in my case its when I ssh into the OS X box. Basically it works fine, but if I leave my desk for a few minutes, when I come back ssh on my linux box is unresponsive and requires killing.

It happens with both openssh and ssh.com on linux, so I assume its a problem with openssh on OS X.
 
Short answer: Your connections are timing out. You can probably fix this this by editing the ssh/sshd config files. There's no need to kill the stalled ssh process -- evententually it will get tired of waiting and come back to life.

Have a look at the ssh/sshd man pages, and then make sure both your client ssh config file and server sshd config file enable 'KeepAlive' (i.e. "KeepAlive yes"). (If you don't have access to the server sshd config, setting keep alive for the client might be enough.) You may need to restart sshd for this to take effect. Also, some ISPs have firewalls which block incoming packets on certain ports. I think this may interfere with the KeepAlive packets, which is why connections might hang from home but not from work.
 
Thanks for the suggestions. I did suspect timing out to be the likely cause, to be honest. I'm unfortunately not convinced the terminal window would come back to life, as I had waited quite a few minutes in the past. Maybe I'm just impatient!

I checked /etc/sshd_config on work's server, I found "KeepAlive yes." Then I also found /etc/sshd2/sshd2_config. Now, here KeepAlive is commented out! I thought ssh2 was backwards compatible with ssh1, so if they had to run different ssh servers, with different configurations, I'd be very surprised. I think the Terminal app on OS X uses the ssh2 protocol by default and is therefore not being kept alive; whilst at work I know I'm using a client that uses ssh1 (and therefore is being "kept alive?").

Hmm, I wonder if I need to contact the administrators about the sshd2 configuration... I should also double check that the ssh client on OS X is set up for KeepAlive but I don't remember seeing anything relevant.
 
I was under the impression that 'KeepAlive yes' was the default on OpenSSH's ssh2 servers. I will add it to the config though.
 
Back
Top