PDA

View Full Version : logout root user from inactive session



mitto
10-30-2006, 09:01 AM
Generraly, administrators will stay login as “root” or forget to logout after finishing their work and leave their terminals unattended.

The answer to solve this problem is to make the bash shell automatically logout after not being used for a period of time. For that, you must set the special variable named “TMOUT” to the time in seconds of no input before logout.

Edit your profile file (vi /etc/profile) and add the following line somewhere after the line that read “HISTSIZE=” on this file:


TMOUT=7200

The value we enter for the variable “TMOUT=” is in seconds and represents 2 hours (60 * 60 = 3600 * 2 = 7200 seconds). It is important to note that if you decide to put the above line in your /etc/profile file, then the automatic logout after two hours of inactivity will apply for all users on the system. So, instead, if your prefer to control which users will be automatically logged out and which ones are not, you can set this variable in their individual .bashrc file.

After this parameter has been set on your system, you must logout and login again (as root) for the change to take effect.

HosTechS
01-09-2007, 01:52 AM
Hello,

this is a good information.

Well I would always that a good administrator is one who logs in as root in the server and after he finishes the job logs out.

Thank you.

Regards,

sparktechs
01-11-2007, 04:31 AM
Also you can also force a user to log out by issuing the command

skill -9 pty(number)

:)