Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to automatically logout user from the login shell after period of inactivity  (Read 1006 times)

0 Members and 1 Guest are viewing this topic.

joseletk

  • Guest
The proper way to achieve this is to set TMOUT variable to the number of seconds to wait for an user input using global profile.

Execute following commands to define 120 seconds timeout.

Code: [Select]
$ cat << EOF | sudo tee /etc/profile.d/tmout.sh
# Execute only outside of X-terminal
[ -z "\$DISPLAY"  ] || return 0

export TMOUT=120
EOF

Code: [Select]
$ sudo chmod 644 /etc/profile.d/tmout.sh
Changes will take place after user re-login. Bash will simply terminate after timeout.
======================================================================================================