You can `readonly TMOUT=300; export TMOUT` to have bash (for CSH/TCSH try `set -r autologout= 5`) to you off automatically if you leave the shell idle for more than 5 minutes. The variable is read-only, so users can not change the value. See https://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/ for more info.