What is this auto logout?
Ans : Auto logout is a concept to force user to logout from the remote server. If the open session to remote server is idle for a given time. This is a security measure Linux administrators follow for terminating idel sessions to remote servers.
Why actually we require auto logout?
Ans : As a security measure, This is a good practice to set this, because it’s not a good idea/practice to keep open terminal idle for longer duriations.
How to accomplish this for a system wide setting?
Ans : This can be achieved by two ways.
1. Open /etc/profile and append TMOUT variable. See my below example
Export TMOUT=600 # 10 minutes in seconds
typeset -r TMOUT
This will set time-out to 600 sec(ie 10mins) and I have given typeset -r which read-only and will not allow users to change this. Save the file and exit.
2. By creating /etc/profile.d/sessiontimout.sh file then keeping above mention entries in it.
Export TMOUT=600 # 10 minutes in seconds
typeset -r TMOUT
Now save and exit the file
As this is a script we have to change the permissions too.
#chmod +x /etc/profile.d/sessiontimout.sh
How to accomplish this for individual users?
Ans : We can edit ~/.bashrc file as given below.
Open ~/.bashrc file for a given user and write below two line in to it.
TMOUT=600
export TMOUT
Save the file and source it as given below.
source ~/.bashrc
This change can be seen only for that user. Please share your thoughts on this, if you know better option to do it.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018