Go deep into Linux Log cleanup

Source: Internet
Author: User
Go deep into Linux Log cleanup-Linux Enterprise Application-Linux server application information. The following is a detailed description. I remember reading books in the library when I was in school. I saw that a deep hacker did not clear all the logs after the intrusion, but erased the information about his login, at that time, I thought it was impossible. Of course, I didn't even know how to delete all the logs. Haha.

In the past few days, I finally learned the mysteries and felt very comfortable. Thanks to my ability to read English documents, I searched GOOGLE for a long time, I have never been able to find a good article. I have read a lot of comprehensive introduction to linux system logs in Chinese. This knowledge has been available before and there is no higher improvement. Then I thought, is there a lot of information in English? Search:

Modify wtmp, haha, all of them have come out, and several C source codes have been compiled successively, such as gcc-o cloak2 cloak2.c. Among them, wted is very handy and has powerful functions, it is because someone else has a usage () function that tells you how to use it. Other programs do not use the document and can only be seen through the Parameter definition in main in the C code. It is not too difficult, later, I found a very powerful C code for lastlog modification, but I had no idea how to use it. In addition, its document only says that the lastlog record can be deleted, I didn't say I could modify it (that is, the modify I want). Now I am looking at GOOGLE at will. Fortunately, I was able to see the program principle written by the author of this program. It's amazing, read it all twice. OK. You only need to connect the UTC format to the end of the-d option, and the time is in seconds. Haha, you will know it without reading the document!

The above section indicates clearing the logs of wtmp lastlog. For example. bash_history message secury's log is relatively simple, because it is a text editable file, you can directly operate, of course, do not operate on your own line, my approach is to log on to the system first backup. bash_history, and then test it back when you log on again, so that the history will be restored smoothly. I implemented it using the script SHELL, clearing WTMP at a time, modifying LASTLOG, and restoring history, delete the script and use sed to delete logs related to message secury (mainly sed-e '/my IP Address/D'/var/log/secury> secury. bak; mv-f secury. bak/var/log/secury; sed-e '/My Logon Time/D'/var/log/message> ......) It's easy, just 20 rows.

So I logged on to the linux server for testing and finally learned how to clear my own logs.

Through this special log clearance, even powerful linux logs are not as admired as before. After all, such a poor level of log can be achieved only in the system after intrusion. bash_history left an exitt Script Name. Generally, after seeing this exitt, I thought it was a wrong command to exit the system. In fact, it was a big script that was put under/sbin, the last sentence of the script is:

Rm-f/sbin/exitt

"The sky has no traces of birds, but I have flown over." I strongly worship myself.

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.