方法一:
编辑 /etc/pam.d/common-session-noninteractive ,找到这一行, 通常在最后:
session required pam_unix.so
在它之前添加:
session [success=1 default=ignore] pam_succeed_if.so service in cron quiet use_uid
保存退出,重启 crond 服务
service cron restart
方法二:
编辑 /etc/rsyslog.conf ,找到:
auth,authpriv.* /var/log/auth.log
在之前添加一行:
:msg, contains, "pam_unix(cron:session)" ~
然后重启 rsyslog 服务:
systemctl restart rsyslog
参考:
https://www.cnblogs.com/azureology/p/15114686.html
https://unix.stackexchange.com/questions/139323/dont-log-cron-events-in-auth-log