How To Auto-Logout Idle Session For User In Linux

You can set the logout session for all users in Linux Server because if you don’t close the session, it will remain open up ideally. So it’s better to close it. You can do this automatically. Let’s see how to auto-logout session. We can set an auto logout and an idle user session timeout from the terminal in Linux.

Check Out: How To Check Linux Logs And Where They Exist 

How To Auto-Logout Idle Session For User In Linux:

There’re many ways to do this but I will show you a few of the best ones. You can do this for security purposes.

Method 1: you can do this by adding some parameters in the .bashrc file.

export TMOUT=600 # for 10 mins
readonly TMOUT

Apply the changes by running the command, so the user would not be able to change the values.

source /root/.bashrc 

Check Out: How To Find UUID of Storage Devices

Method 2: you can create a file under the directory /etc/profile.d

export TMOUT=600 # for 10 mins 
typeset -r TMOUT 

Now you need to make this file to be executable.

chmod +x

As you can see I have created user “Pankaj” and switch with this user on the Linux and left idle.

configure auto logout session expired

After 60 sec, you can see the message “time out waiting for input: auto> logout” means it’s working perfectly and user Pankaj logout the session automatically.

YouTube Link: Auto logout session Linux

You’re done linux idle session timeout auto logout terminal

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment