Extending SSH timeout (server side solution)?

Installing, Configuring, Troubleshooting server daemons such as Web and Mail
Post Reply
theboyk
Posts: 1
Joined: 2012/10/16 15:44:20

Extending SSH timeout (server side solution)?

Post by theboyk » 2012/10/16 16:00:34

Hello.

I'm running a Parallels Plesk 11 installation with CentOS release 5.8 (Final). When I'm logged in via SSH, after 5 minutes of inactivity, the session times-out (broken pipe). I've search everywhere and have no clue where the length of time is being set before the SSH session is terminated. Looking at the regular culprits in sshd_config, all of the following are commented out:

TCPKeepAlive
ClientAliveInterval
ClientAliveCountMax

So, it's not sshd_config setting the 5-minute timeout duration before SSH is killed. None-the-less, I was hoping to extend this, server-wide, to 10 minutes. So, I've uncommented the following and set them as follows:

TCPKeepAlive Yes
ClientAliveInterval 60
ClientAliveCountMax 10

From my understanding of ClientAliveInterval and ClientAliveCountMax, this *should* keep an SSH session alive for 10 minutes (without activity). But, that doesn't seem to be the case? While setting the above has INCREASED the timeout duration beyond 5 minutes, I'm now unsure how long it'll be kept alive? I've had an inactive SSH session alive for almost 25 minutes now. And again, based on my understanding of ClientAliveInterval and ClientAliveCountMax, via the man page, the session should timeout after 10 minutes (based on my settings).

Am I incorrect in my understanding of how this should work?

Thanks,
Kristin.

User avatar
TrevorH
Forum Moderator
Posts: 26971
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Extending SSH timeout (server side solution)?

Post by TrevorH » 2012/10/16 16:05:35

My usual solution for this is client side - in $HOME/.ssh/config add [b]ServerAliveInterval 300[/b] though putty etc have a similar setting in their set up pages.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Extending SSH timeout (server side solution)?

Post by gerald_clark » 2012/10/16 16:14:38

man sshd_config

ClientAliveCountMax is used to close dead connections after the specified number of keepalive messages are not acknowledged.

koun
Posts: 1
Joined: 2013/12/19 03:26:30

Re: Extending SSH timeout (server side solution)?

Post by koun » 2013/12/19 03:40:22

I am afraid to be too late for this question. But, I want to write my comment.
I had also this problem.
Combination of ClientAliveCountMax and ClientAliveInterval did not work as I expected. I suspect that the action of these parameters is not the one which we want to do.
Maybe, these parameters act on something internal operation of ssh, but not on user's operation. For this purpose, it's better to handle terminal session, but not to handle sshd.
For example, for bash, edit /etc/bashrc
TMOUT = 400
readonly TMOUT
export TMOUT

Post Reply

Return to “CentOS 5 - Server Support”