Difference between revisions of "Bash"
From Briki
(→Force autologout of root and other privileged account shells after inactivity) |
(→Force autologout of root and other privileged account shells after inactivity) |
||
| Line 1: | Line 1: | ||
== Force autologout of root and other privileged account shells after inactivity == | == Force autologout of root and other privileged account shells after inactivity == | ||
| − | Add to /etc/profile:<pre> | + | Add to /etc/bash.bashrc (not /etc/profile, or it will only be set when running '''su -''' and not '''su'''):<pre> |
if [ `id -u` -lt 500 ]; then | if [ `id -u` -lt 500 ]; then | ||
# Override console timeout for root and other system users | # Override console timeout for root and other system users | ||
Revision as of 09:30, 7 September 2006
Force autologout of root and other privileged account shells after inactivity
Add to /etc/bash.bashrc (not /etc/profile, or it will only be set when running su - and not su):
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
You can probably get rid of the declare line at the bottom - this just ensures that TMOUT cannot subsequently be modified.