Operating System - HP-UX
1752272 Members
4481 Online
108786 Solutions
New Discussion

ssh session gets hung after remaining idle for few hours or minutes

 
Indrajit Bhagat
Regular Advisor

ssh session gets hung after remaining idle for few hours or minutes

Hello Experts,

 

I had two servers , where one server ssh connection is not getting timeout and is remaning live even after accessing after few hours.

 

And in one server, ssh session gets hung if the session remains idle. (This is problem)

 

May i have an solution for the same.

2 REPLIES 2
Laurent Menase
Honored Contributor

Re: ssh session gets hung after remaining idle for few hours or minutes

Hi Indrajit,

any firewall between the server and client?

 

Else they can use Alive options of ssh

man ssh_config

     ServerAliveInterval

ServerAliveCountMax

 

man sshd_config

ClientAliveCountMax

ClientAliveInterval

 

Bill Hassell
Honored Contributor

Re: ssh session gets hung after remaining idle for few hours or minutes

You could also add the TMOUT variable to .profile so the shell will timeout and disconnect:

export TMOUT=3600

This will timeout with no typing in the shell after 60 minutes (3600 seconds).

(this assumes that your shell is ksh, POSIX sh or bash)



Bill Hassell, sysadmin