The whole article is at:
The section you need is;
Set login time out for the root account. Despite the notice to never, if they are not on the server sign in as root and leave it unattended, administrators still stay on 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. To do that, you must set the special variable of Linux named TMOUT to the time in seconds of no input before logout. Edit your profile file /etc/profile and add the following line somewhere after the line that read HISTFILESIZE= on this file:
...if you remark this "timeout" from your /etc/profile file, then it should not close the session. The way to do that is to put a '#' or hash mark in front of it thus;
although the number is much lower in your file, this one is equivalent to 7200 seconds, or 120x60sec=2 hours.
To edit /etc/profile, you need to be root, open a terminal window, type su -<enter>
enter your admin password, and then type gedit /etc/profile
If you do not log in as root to do the edit, you will not be able to save any changes to the file.
Alternately, if that time out line is not there, add it in, and make it ...say...
which will give you 8 hours before it closes on you.