Force inactive user logout


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 sysadmins 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


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.


I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.