Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Manjaro command audit ordinary user log format is not valid problem resolution record

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Recently, I have been messing with the manjaro xfce version to implement the command audit. Please refer to the following blog

Https://blog.51cto.com/13227377/2159238

The specific operations are as follows:

Add after / etc/profile

# historyexport HISTSIZE=4096DT= `date + "% Y-%m-%d" `export HISTFILE= "/ opt/history/$ {LOGNAME} _ history.log" chmod 600 / opt/history/$ {LOGNAME} 2 > / dev/nullexport PROMPT_COMMAND=' {date "+% Y-%m-%d% T # $(history 1 | {read x cmd; echo" $cmd ";})";} > > $HISTFILE'

After adding, it was found that the PROMPT_COMMAND variable did not take effect, that is, the record format of log in the log file was not changed, and later found that the user environment variable reset PROMPT_COMMAND.

The solution is as follows:

Step one:

Sudo gedit / etc/bash.bashrc

Comment out some of the code in the figure

Step 2:

Gedit / .bashrc

Comment out some of the code in the figure

Step 3:

Source / etc/bash.bashrcsource ~ / .bashrc

At this moment, the format in history.log has been changed to the format set in the command audit.

The log format changes as follows

Before modification

After modification

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report