Command history and automatic logout

Environment variable location

System environment variable location: /etc/profile

User environment variable location: /home/usr

p>

Command history modification

The command history mechanism of the Shell environment provides users with great convenience, but on the other hand, it also brings potential risks to users. . As long as the user’s command history file is obtained, the user’s command operation process will be at a glance, so it is necessary to automatically log out the command history.

In the bash terminal environment, there are 1000 historical commands. Controlled by the variable HISTSIZE, all users in the system can be affected by modifying the value of the HSITSIZE variable in the /etc/profile file.

First check the current history commands

Command history and automatic logout

The above figure shows 6 historical commands

Enter the system configuration file /etc/profile

command history and automatic logout

command history and automatic logout

Command history and automatic logout< /p>

Command history and automatic logout

Configuration completed, view history Verification

command history and automatic logout

if not required For history command records, just change the value to 0, but there is a command history record that will facilitate user operations, so a more effective operation is to clear the history record when logging out. This method is introduced below.

Enter the user environment variable control file

Command history and automatic logout

Command history and automatic logout

Write Just order

command history and automatic logout

< strong>Automatic logout

Automatic logout is also set in the environment variable file, command: export TMOUT=

Command history and automatic logout

Command history and automatic logout

Command history and automatic logout

Automatic logout succeeded after 30s

Command history and automatic logout

Leave a Comment

Your email address will not be published.