Bash Configure Automatic Logout [ Linux / Unix / Apple OS X ]

You can configure automatic logout in the bash shell by setting the TMOUT environment variable. The value of this variable specifies the number of seconds of inactivity after which the shell will log out automatically.

To set automatic logout for your current session, you can use the following command:

export TMOUT=300

This will set automatic logout after 300 seconds (5 minutes) of inactivity.

To set this permanently for a user, you can add the above line to the user’s shell profile file, such as ~/.bashrc for the bash shell.

Note that if you want the automatic logout to be effective for all users on the system, you can add the line to a system-wide configuration file, such as /etc/profile or /etc/bashrc.

Leave a Comment