Linux

Automatic log out idle users in linux

Some users have this (nasty) habit of staying logged into their shells. Not just one, but A LOT of them, very annoying to see all those idle connections (IMHO). So to prevent these idle connections from staying open until the end of days is to set a simple environment variable called “TMOUT”.

Add the following line to your /etc/profile to make it system wide:

export TMOUT=3600

The above line will auto log out users that are idle for 3600 seconds, which is of course, an hour. :)

This method has a few drawbacks:

  • This only works on command line console shell, not in X environment.
  • If the user has an opened application (f.e. top or vim), it will not work.
  • Users can disable this function by setting “export TMOUT=0” in there current shell.

Leave a Reply

Your email address will not be published.

*