Linux (ubuntu centos) set terminal timeout

In order to enhance the security of the Linux system, we need to automatically disconnect after the user input is idle for a period of time. This operation can be achieved by setting the TMOUT value. Just add the following fields to /etc/profile (valid for all users).

export TMOUT=900 # Set the field to disconnect the terminal if the user does not operate within 900 seconds

readonly TMOUT # set the value to readonly to prevent user changes

Note: After setting readonly, it cannot be canceled under the current shell. You need to comment out the readonly line in /etc/profile or delete it directly, logout and then log in again.

vi /etc/profile

export TMOUT=900 # Set the idle time to 15 minutes, in seconds; if there is no such line, add it directly

Save and exit, use the command source /etc/profile to take effect immediately

Shortcut settings

We can adjust the time for linux to judge our login timeout by setting the environment variable TMOUT.

set TMOUT=9000

You can also use the reset method to restore.

———————————————

Copyright statement: This article is an original article by CSDN blogger “xmayu” and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.

Original link: https://ift.tt/VAy1FwQ

The post Linux (ubuntu centos) Setting Terminal Timeout first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8727
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment