Configure BASH, KSH, TCSH, ZSH Shell To Logout User Automatically After Idle Time

Configure BASH, KSH, TCSH, ZSH Shell To Logout User Automatically After Idle Time

To configure a BASH, KSH, TCSH, or ZSH shell to log out a user automatically after a certain period of idle time, you can use the TMOUT shell variable.

  1. To set the idle time in seconds after which the user will be logged out, add the following line to the appropriate configuration file for your shell (e.g., ~/.bashrc, ~/.zshrc, etc.):
refer to:‮tual‬turi.com
TMOUT=3600

This will set the idle time to one hour (3600 seconds). You can adjust the value to your desired time.

  1. To disable the idle logout feature, set the TMOUT variable to 0:
TMOUT=0
  1. You may need to log out and log back in for the changes to take effect.

Note: The TMOUT variable is only supported in BASH, KSH, and TCSH. In ZSH, you can use the TMOUT variable or the IDLE_TIMEOUT variable, which works in the same way.

Created Time:2017-10-28 14:02:23  Author:lautturi