From 1bc839b375b23ffbb442133f10531664ba9fb413 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 May 2021 22:10:21 +0200 Subject: [PATCH] Set timeout when logged as root --- root/etc/profile.d/shell-timeout.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/root/etc/profile.d/shell-timeout.sh b/root/etc/profile.d/shell-timeout.sh index f90b32f..aa99b77 100644 --- a/root/etc/profile.d/shell-timeout.sh +++ b/root/etc/profile.d/shell-timeout.sh @@ -1,8 +1,16 @@ # Set automatic timeout for shell # which will automatically log out the user after certain amount of time -# This will not work on termunal emulators in X11 -TMOUT="$(( 60*10 ))"; + +# This will only be applied for non-graphical sessions, +# or whenever root account is logged in + +TMOUT=600 +readonly TMOUT + [ -z "$DISPLAY" ] && export TMOUT; -case $( /usr/bin/tty ) in + +case $(/usr/bin/tty) in /dev/tty[0-9]*) export TMOUT;; esac + +[ $UID -eq 0 ] && export TMOUT;