Automatically sign out root account
I typically walk away from my computer and get side tracked doing something else. I have more then once came back just to see a terminal window open still signed in as root. To make matters worse I use a plasma widget called plasmacon that embeds a terminal window in to my desktop. There is a very easy solution to this problem.
In the root home directory (/root/) create a file called (.bashrc) and enter the following line in to that file.
TMOUT=N |
N = The number of seconds to wait before timing out the account.
Now when you walk away from your computer with the root account signed in it will automatically log out after the number of seconds you chose. This can also be used for other users as well. Just do the same procedure in the home directory of the user you would like to automatically be signed out. This will only work on bash sessions, it will not sign you out of an X session.
Edit: 2/11/2012
One good point that I left out is if you set this timeout to low you might leave the root account inaccessible. The way to fix this if it happens is with this command.
With nano:
su root -c 'nano ~/.bashrc' |
With VI:
su root -c 'vi ~/.bashrc' |
This will allow you to edit the .bashrc file without login in to the root account.
Share