You can configure any Linux system to automatically log users out after a period of inactivity. Simply login as the root user and create a file called /etc/profile.d/autologout.sh, enter::
# vi /etc/profile.d/autologout.sh
Append the following code:
TMOUT=300 readonly TMOUT export TMOUT
# chmod +x /etc/profile.d/autologout.sh
Above script will implement a 5 minute idle time-out for the default /bin/bash shell. You can also create tcsh version as follows:
# vi /etc/profile.d/autologout.csh
Append the following code:
set -r autologout 5
# chmod +x /etc/profile.d/autologout.csh
Dealing with ssh clients
# vi /etc/ssh/sshd config
Find ClientAliveInterval and set to 300 (5 minutes) as follows:
ClientAliveInterval 300 ClientAliveCountMax 0
# service sshd restart