Session timeout setting in server

Hi All

I need to set timeout of login session of a user if a user is idle for some time.

I know the TMOUT setting but it work with only BASH & KORN shell only as I need to set for Bourne shell also. I am trying to put "ClientAliveInterval 300" in sshd_config & restart or refreshing the ssh service. But after idling for more than 300 seconds,Still user is not automatically logout.

Where I am missing please help me this regards

You gotta set ClientAliveCountMax=0

See what man sshd_config says:

ClientAliveCountMax

         Sets the number of client  alive  messages  (see  Clien-
         tAliveInterval,  below)  that  can  be sent without sshd
         receiving any messages back from  the  client.  If  this
         threshold  is  reached  while  client alive messages are
         being sent, sshd disconnects the client, terminating the
         session.  It is important to note that the use of client
         alive messages is very  different  from  KeepAlive  (see
         below).  The  client alive messages are sent through the
         encrypted channel and therefore are not  spoofable.  The
         TCP  keepalive option enabled by KeepAlive is spoofable.
         The client alive mechanism is valuable when a client  or
         server  depend  on  knowing when a connection has become
         inactive.

         The default value is 3. If  ClientAliveInterval  (below)
         is  set  to  15,  and ClientAliveCountMax is left at the
         default, unresponsive ssh clients are disconnected after
         approximately 45 seconds.
1 Like