Typically in an Enterprise setup, we would see Users login from various terminals via SSH but never bother to disconnect the established session. This might cause a slight overload on the Network, since these Established sessions have to maintain their connections by sending Alive packets. So I guess it would be appropriate if we make these Users automatically Logout after a certain period of Inactivity (say 1 hour).
Solution 1:
TMOUT=3600
Solution 1:
Create a file called "autologout.sh" under /etc/profile.d with execute permission.
# touch /etc/profile.d/autologout.sh
# chmod 711 /etc/profile.d/autologout.sh
Add the following entries to it (Assuming we have to automatically Logout the users after 1 hour, which is 3600 seconds).
TMOUT=3600
readonly TMOUT
export TMOUT
Solution 2:
Enable the following directives in SSH config file (/etc/ssh/sshd_config) and reload the 'sshd' service.
ClientAliveInterval 3600
ClientAliveCountMax 0
# service sshd reload (or) # service sshd restart