How to clear user logon records and command history using CentOS

Source: Internet
Author: User
Clear the records that have been successfully logged on to the system [root @ localhostroot] # echo & gt;/var/log/wtmp // garbled characters when this file is opened by default, ip address and other information can be found [root @ localhostroot] # last // at this time, the user login information cannot be found to clear the logon system failure record [root @ localhostroot Clear records of successful login to the system[Root @ localhost root] # echo>/var/log/wtmp // garbled characters when this file is opened by default, ip address and other information can be found [root @ localhost root] # last // user logon information cannot be found at this time
Clear records of system logon failures[Root @ localhost root] # echo>/var/log/btmp // garbled characters when this file is opened by default, you can find the logon failure information [root @ localhost root] # lastb // you cannot find the logon failure information. Clear History execution commands[Root @ localhost root] # history-c // run the [root @ localhost root] # echo>./. bash_history // or clear the file in the user directory. Import null history records[Root @ localhost root] # vi/root/history // create a record file [root @ localhost root] # history-c // clear the record [root @ localhost root] # history- r/root/history.txt // import record [root @ localhost root] # history // query the 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
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.