去掉message日志文件中su命令的记录-成都快上网建站

去掉message日志文件中su命令的记录

脚本执行需要root权限,但脚本中使用su命令来执行其他命令或脚本,比如使用nginx用户调用日志统计脚本。

10年积累的网站设计、成都网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有湘潭县免费网站建设让你可以放心的选择与我们合作。

去掉message日志文件中su命令的记录

在/var/log/message日志中有过多的日志显示

Jun 28 10:28:06 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:06 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:06 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:07 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:08 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:08 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:08 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:08 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:08 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:08 localhost su: (to nginx) chuangyw on none
Jun 28 10:28:08 localhost su: (to nginx) chuangyw on none

严重影响message的阅读和过滤;

计划将信息重新建立一个文件保存比如/var/log/su

修改/etc/rsyslog.conf

在message条目中添加:

auth.none

增加条目:

auth.*     /var/log/su

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none;auth.none                /var/log/messages

# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure
auth.*                                                  /var/log/su
# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog

记得重启rsyslog生效

systemctl restart rsyslog.service


标题名称:去掉message日志文件中su命令的记录
URL地址:http://kswjz.com/article/ipopgi.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流