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.
Check Out: How To Find UUID of Storage Devices
Method 2: you can create a file under the directory /etc/profile.d
vim logoutsession.sh export TMOUT=600 # for 10 mins typeset -r TMOUT
Now you need to make this file to be executable.
chmod +x logoutsession.sh
As you can see I have created user “Pankaj” and switch with this user on the Linux and left idle.
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