How to clear historical Command records and logon system records

Source: Internet
Author: User
1. Clear the records of successful login to the system, that is, the records displayed by the last command [root @ linuxzgf ~] Echovarlogwtmp this file is garbled by default when it is opened, and the ip address and other information verification processes can be seen in it [root @ linuxzgf ~] # Lastrootpts010.5.10.51ThuSep200: 59stillloggedinrootpts210. 5.10

1. Clear records of successful login to the system, that is, lastCommandRecord
[Root @ linuxzgf ~] Echo>/var/log/wtmp this file is garbled by default when it is opened, and the ip address and other information can be seen in it.

Verification process
[Root @ linuxzgf ~] # Last
Root pts/0 10.5.10.51 Thu Sep 2 00:59 still loggEdIn
Root pts/2 10.5.10.60 Wed Sep 1)
Root pts/2 10.5.10.60 Wed Sep 1)
Root pts/0 10.5.10.61 Wed Sep 1)
Root pts/3 10.5.10.59 Wed Sep 1)
Root pts/2 10.5.10.60 Wed Sep 1)
Root pts/1 10.5.10.191 Wed Sep 1)
.......................

[Root @ linuxzgf ~] # Echo>/var/log/wtmp
[Root @ linuxzgf ~] # Last

Wtmp begins Thu Sep 2 01:04:34 2010
[Root @ linuxzgf ~] #

The user logon information is invisible.

2. Clear the system logon failure record, that is, the record seen by the lastb command.
[Root @ linuxzgf ~] Echo>/var/log/btmp this file is garbled by default when it is opened

Verification Method
Run the following command before executing the command:
[Root @ linuxzgf ~] # Lastb
Root ssh: notty 10.5.10.60 Wed Sep 1)
Tty6 Mon Aug 30)
Tty6 Mon Aug 30)
Tty6 Mon Aug 30)
++ Tty6 Mon Aug 30)
Linuxzgf ssh: notty 10.5.10.60 Mon Aug 30)
Linuxzgf ssh: notty 10.5.10.60 Mon Aug 30)
.........

Then execute

[Root @ linuxzgf ~] # Echo>/var/log/btmp
[Root @ linuxzgf ~] # Lastb

Btmp begins Thu Sep 2 01:01:06 2010

No result is output.

Nice?

 

3. Clear history execution commands

[Root @ linuxzgf ~] History-c

Or

Clear the file in the user directory.
[Root @ linuxzgf ~]> ~ /. Bash_history

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.