Login related
Linux systems have three standard commands to display the user's most recent login information:last,lastb,andlastlog.
The output information of these commands includes login user name, last login time, IP address, etc.
For better anonymity, you can clear this information.
-
last command, corresponding log file /var/log/wtmp; successfully logged in user
-
lastb command, corresponding log file /var/log/btmp; try to log in information
-
The lastlog command, the corresponding log file /var/log/lastlog; displays the latest login information
Clear the record of successful login to the system
-
[root@localhost root]#echo > /var/log/wtmp//This file is garbled when it is opened by default, and ip and other information can be found
-
[root@localhost root]#last//The user login information cannot be found at this time
Clear the log of failed login system
-
[root@localhost root]# echo > /var/log/btmp//This file is garbled when it is opened by default, and the login failure information can be found
-
[root@localhost root]#lastb//Cannot find login failure information
Bash history related
-
<space>command //When executing the command, specify that Bash does not save the execution history
-
history -r //Clear the history of the current login session
-
history -cw //Clear all history
Clear command history
-
[root@localhost root]# history -c //Clear history execution command
-
[root@localhost root]# echo > ./.bash_history//or clear this file in the user directory
Import empty history
-
[root@localhost root]# vi /root/history//New record file
-
[root@localhost root]# history -c//Clear records
-
[root@localhost root]# history -r /root/history.txt//Import records
-
[root@localhost root]# history//Query import result
example
-
[root@localhost root]# vi /root/history
-
[root@localhost root]# history -c
-
[root@localhost root]# history -r /root/history.txt
-
[root@localhost root]# history
-
[root@localhost root]#echo > /var/log/wtmp
-
[root@localhost root]#last
-
[root@localhost root]#echo > /var/log/btmp
-
[root@localhost root]#lastb
-
[root@localhost root]#history -c
-
[root@localhost root]#echo > ./.bash_history
-
[root@localhost root]#history
clear.sh
echo > /var/log/wtmp
echo > /var/log/btmp
history -c
echo > ./.bash_history