How do I auto Logout my shell user in Linux after certain minutes of inactivity?
Linux bash shell allows you to define the TMOUT environment variable. Set TMOUT to automatically log users out after a period of inactivity. The value is defined in seconds. For example,
export TMOUT=120
The above command will implement a 2 minute idle time-out for the default /bin/bash shell. You can edit your ~/.bash_profile or /etc/profile file as follows to define a 5 minute idle time out:
# set a 5 min timeout policy for bash shell
TMOUT=300
readonly TMOUT
export TMOUT
Save and close the file. The readonly command is used to make variables and functions readonly i.e. you user cannot change the value of variable called TMOUT.
How Do I Disable TMOUT?
To disable auto-logout, just set the TMOUT to zero or unset it as follows:
$ export TMOUT=0
or
$ unset TMOUT
Please note that readonly variable can only be disabled by root in /etc/profile or ~/.bash_profile
Subscribe to:
Post Comments (Atom)
Complete list of recommended VS Code extensions for writing and managing AWS Terraform scripts , including syntax checking, variable supp...
-
# Ansible module and some advance options Modules: Command: This module help you to execute commands to the target host, it may be comma...
-
=================== Deployment ================= 1.) Deployment without any nodeName or nodeSelector, pod will spread among all of the av...
-
# Ansible gathering facts from remote servers. ============================= ====================================== getting facts fro...
No comments:
Post a Comment