2021-04-30 00:16:50 +00:00
|
|
|
# Set automatic timeout for shell
|
|
|
|
# which will automatically log out the user after certain amount of time
|
2021-05-10 20:10:21 +00:00
|
|
|
|
|
|
|
# This will only be applied for non-graphical sessions,
|
|
|
|
# or whenever root account is logged in
|
|
|
|
|
2021-07-14 12:27:41 +00:00
|
|
|
# If TMOUT was already set, unset it
|
|
|
|
unset TMOUT
|
2021-05-10 20:10:21 +00:00
|
|
|
|
2021-07-14 12:27:41 +00:00
|
|
|
# Define the timeout delay (seconds)
|
|
|
|
TIMEOUT=600
|
2021-05-10 20:10:21 +00:00
|
|
|
|
2021-07-14 12:27:41 +00:00
|
|
|
# Set TMOUT when display is not set
|
|
|
|
[ -z "$DISPLAY" ] && export TMOUT=$TIMEOUT;
|
|
|
|
|
|
|
|
# Set TMOUT when in TTY
|
2021-05-10 20:10:21 +00:00
|
|
|
case $(/usr/bin/tty) in
|
2021-07-14 12:27:41 +00:00
|
|
|
/dev/tty[0-9]*) export TMOUT=$TIMEOUT;;
|
2021-04-30 00:16:50 +00:00
|
|
|
esac
|
2021-05-10 20:10:21 +00:00
|
|
|
|
2021-07-14 12:27:41 +00:00
|
|
|
# Set TMOUT when user is root
|
|
|
|
[ $UID -eq 0 ] && export TMOUT=$TIMEOUT;
|
|
|
|
|