温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

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

发布时间:2020-07-08 09:00:01 来源:网络 阅读:487 作者:axe999 栏目:建站服务器

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

去掉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



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI