Automatically close idle root terminals

Share your own howto's etc. Not for support questions!

Automatically close idle root terminals

Postby Hallvor » 2014-06-08 16:14

Keeping your root terminal open when other people have physical access to your computer, makes your computer as secure as your normal user account. And if a remote attacker gains access to your normal user account, they also get access to your (in theory) open root terminal. Turning the root terminal off when not in use is basic security practice.

If you still keep forgetting to log out, it can be done automatically. These commands will make the root terminal log out automatically after a given number of seconds:

As root:
Code: Select all
# echo "[ $USER = root ] && export TMOUT=300" >> /etc/profile


As you can see, the time limit is five minutes (300 seconds). Replace 300 with whatever number of seconds you want.

Load the new settings:

Code: Select all
# source /etc/profile


Your open root terminals will now automatically log off as root within the given number of seconds.


Credits: http://linuxg.net/quick-tip-automatical ... nactivity/
HP Elitebook 2570p, Intel Core i5 3320-M CPU @ 2.60 GHz, 6 GB RAM, Intel HD 4000 graphics, 240 GB SSD, Debian Stretch (KDE)
User avatar
Hallvor
 
Posts: 847
Joined: 2009-04-16 18:35
Location: Norway

Re: Automatically close idle root terminals

Postby dasein » 2014-06-08 17:20

Very cool. :cool:

Thanks, Hallvor .
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Automatically close idle root terminals

Postby josephg » 2014-11-14 13:28

you ask to change /etc/profile. i have a /root/.profile too. which one?
josephg
 
Posts: 82
Joined: 2009-01-03 14:01
Location: surrey england

Re: Automatically close idle root terminals

Postby Hallvor » 2014-11-15 14:18

josephg wrote:you ask to change /etc/profile. i have a /root/.profile too. which one?


/etc/profile is for system wide shell variables. It is the file you should edit.
HP Elitebook 2570p, Intel Core i5 3320-M CPU @ 2.60 GHz, 6 GB RAM, Intel HD 4000 graphics, 240 GB SSD, Debian Stretch (KDE)
User avatar
Hallvor
 
Posts: 847
Joined: 2009-04-16 18:35
Location: Norway

Re: Automatically close idle root terminals

Postby josephg » 2014-12-05 12:59

Hallvor wrote:
josephg wrote:you ask to change /etc/profile. i have a /root/.profile too. which one?


/etc/profile is for system wide shell variables. It is the file you should edit.


if this is only for the root user, why should we change system wide settings for all users? thanks
josephg
 
Posts: 82
Joined: 2009-01-03 14:01
Location: surrey england


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable