You can configure any modern shell including bash to auto logout. Please note that autologout will only work for the foreground process. For example, if you left your session idle the automatic shell logout will occur. But, if an interactive process such as top command or a vi text editor session is left idle, then automatic logout would not occur.
Add the following lines to your bash startup file such as $HOME/.bash_profile or create a new bash shell script called timout-settings.sh in the /etc/profile.d directory:
## append in $HOME/.bash_profile ## 300 seconds == 5 minutes ## TMOUT=300 readonly TMOUT export TMOUT
#!/bin/bash ## 300 seconds == 5 minutes ## TMOUT=300 readonly TMOUT export TMOUT
Save and close the file.