Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have requirement where I want my ssh seesion to target will logout after one hour,but currently leaving an ssh session to target board idle does not get auto logout after one hour.

Below is what is set in tagets sshd_config file

ClientAliveInterval 15

ClientAliveCountMax 4

So what changes I need to do so that my ssh session gets logged out after hour if it remains idle.

share|improve this question
up vote 1 down vote accepted

I already encountered situations where ClientAliveCountMax prevents the connection to be disconnected. I would advise the following settings:

# ClientAliveInterval is in seconds
ClientAliveInterval 3600
ClientAliveCountMax 0

This will close the connection after 1 hour if idle.

share|improve this answer
Thanks @Spack will give it a try. – AMIT Oct 8 '13 at 14:52

I had the same requirement and the SSHd ClientAlive* options did not work for me.

I think those are meant to keep the connection alive as opposed to cause when it times out. This means that it relies on the networking equipment timing out idle connection which is not always the case.

If you are running bash/ksh/zsh, you can use the TMOUT environment variable:


This will time out your connection after 60 minutes.

For plain sh, you should be able to use:


More info:

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .