How can I prevent users who forget to log out of interactive sessions from tying up resources?


Issue: Interactive users sometimes forget to log out. The resources they requested for their jobs are tied up until they discover they've done that, or until someone kills the job.

Affected Version: All currently supported releases

Problem:

A user can run an interactive job, and if they forget to log out, they will tie up the resources until the WALLTIME is exceeded. Setting a WALLTIME is difficult, though, as that can cause the user to be logged of unexpectedly.

Solution:

Some Linux shells provide for logging out idle sessions.  Note that this only works when the user is actually at the shell prompt.  

For bash:
There are a couple of ways to accomplish this, but the key is to set the environment variable TMOUT to the number of idle seconds allowed before a user will be logged off. The recommended place to set this is in /etc/profile.d/autologout.sh, with it's contents as (modify the 1200, which is number of seconds, to set it per your own site's requirements):


TMOUT=1200
readonly TMOUT
export TMOUT

 

This will need to be done on all of the compute nodes that allow interactive sessions.  If you wish to give users the option to change that, leave off the "readonly" line.  This will, obviously, allow users to bypass this.  

For csh:
The TMOUT variable does not work for csh. There is an "autlogout" variable that can be set to the number of minutes to allow a user's session to be idle, but users can change (or "unset") that autologout variable and bypass this.

 

Tags: idle sessions, shell, timeout
Last update:
2022-01-28 19:27
Author:
Rob Greenbank
Revision:
1.3
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags