BASH have a TMOUT variable.We can set the TIMEOUT value here for sessions.
Add the TMOUT variable to your /etc/bashrc file:
# vi /etc/bashrc
Set TMOUT to 300 seconds (5 minuets):
This will automatically logout users after 300 seconds of inactivity.
This hack will only work with run level 2, 3 .It will not work with GUI sessions.