无意检查auth.log日志发现有大量的pam_unix(cron:session)信息,如下提示:
CRON[23462]: pam_unix(cron:session): session closed for user root
CRON[23546]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[23546]: pam_unix(cron:session): session closed for user root
CRON[23552]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[23552]: pam_unix(cron:session): session closed for user root
CRON[23769]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[23769]: pam_unix(cron:session): session closed for user root
CRON[23883]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[23883]: pam_unix(cron:session): session closed for user root
CRON[24034]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[24034]: pam_unix(cron:session): session closed for user root
网上搜索了一下相关信息,处理如下:
cd /etc/pam.d
vi common-session-noninteractive
#在pam_unix.so这一行的上面添加,如下:
session [success=1 default=ignore] pam_succeed_if.so service in cron quiet use_uid
#
session required pam_unix.so
:wq!
最后重启 cron 服务
sudo service cron restart