Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to clear Bash logging in Ubuntu system

Shulou Source: shulou.com Published: 2022-06-01 15:48:43 10月03日 Update

This article focuses on "how to clear Bash log records in the Ubuntu system", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to clear Bash log records in Ubuntu system".

1. In penetration testing, to clear the current bash operation, many people will directly history-c clear, but this will empty all .bash _ history, and the administrator with a little common sense will be able to find the problem immediately. Solving this is simple:

The right thing to do is to implement it before launch.

The code is as follows:

Export HISTFILE=/dev/null

Export HISTSIZE=0

That's it.

two。 When logging in to the system, enter the following command directly, and the history will not be recorded after logging in to SSH

The code is as follows:

Unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG

Export HISTFILE=/dev/null

Export HISTSIZE=0

Export HISTFILESIZE=0

3. The most abnormal place to keep a log.

The code is as follows:

[root@c2 ~] # vi / root/.bash_history

The log in this place is the ultimate log and cannot be deleted directly. It needs to be replaced. See the following tips, or modify it directly.

4. Delete the IP skills in the log

The code is as follows:

Sed-I's abc.txt 192.168.100.252 abc.txt 127.0.0.1

At this point, I believe you have a deeper understanding of "how to clear Bash log records in the Ubuntu system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Logs systems code content places skills learning login practicality deeper practices interests perverts commands practicality practicality common sense simple operation methods time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Microsoft Shulou Information NVidia Docker