How to force inactive users to logout automatically after time out on Linux?

When you work on different servers from your system, the sessions are scattered over various terminals across different workspaces. Its a common mistake people usually make by leaving one or more of those server sessions open. Such sessions can lead to bad things if they get in hands of someone else. So, instead of blaming the user its always a good practice for sys-admins to automatically logout a user who is inactive for quite sometime.

So, its a good idea to add a TimeOut after which a user will be automatically logged out of the system.

You can add it to your .bash_profile or .profile (for a specific user) OR you can add it to /etc/profile or /etc/bashrc for all system users.

[root]# vim /etc/profile

EXPORT TMOUT=600

This will logout a user if he/she is inactive for 10 min.

NOTE: This won't work in case of GUI, its a level 2, 3 setting. For a GUI environment, you can use any auto-lock system. Also it wont work if you have any application running, for example - an open document.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.