Bash

From Briki
Revision as of 10:47, 6 September 2006 by 205.228.74.13 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Force autologout of root and other privileged account shells after inactivity

Add to /etc/profile:
if [ `id -u` -lt 500 ]; then
    # Override console timeout for root and other system users
    TMOUT_ROOT=3600
    if [ -n "$TMOUT" ]; then
        if [ "$TMOUT" -eq "0" -o "$TMOUT" -gt "$TMOUT_ROOT" ]; then
            TMOUT=$TMOUT_ROOT
        fi
    else
        TMOUT=$TMOUT_ROOT
    fi
fi
type declare > /dev/null 2>&1 && declare -r TMOUT