由于pam配置centOS,您(root)不允许访问(crontab)

时间:2017-09-19 21:10:27

标签: linux bash cron centos7

当我这样做时,我收到了这个错误。

crontab -e
You (root) are not allowed to access to (crontab) because of pam configuration.

我评论了

下的所有内容
cat /etc/pam.d/crond
#
# The PAM configuration file for the cron daemon
#
#
# No PAM authentication called, auth modules not needed
#account    required   pam_access.so
#account    include    password-auth
#session    required   pam_loginuid.so
#session    include    password-auth
#auth       include    password-auth

我在/etc/security/access.conf

中添加了以下内容
#+ : ALL : ALL
#+ : root : cron

这是cron log

Sep 19 21:01:01 localhost crond[65409]: (root) PAM ERROR (Authentication failure)
Sep 19 21:01:01 localhost crond[65409]: (root) FAILED to authorize user with PAM (Authentication failure)
Sep 19 21:02:01 localhost crond[65541]: (root) PAM ERROR (Authentication failure)
Sep 19 21:02:01 localhost crond[65541]: (root) FAILED to authorize user with PAM (Authentication failure)
Sep 19 21:03:01 localhost crond[65677]: (root) PAM ERROR (Authentication failure)
Sep 19 21:03:01 localhost crond[65677]: (root) FAILED to authorize user with PAM (Authentication failure)
Sep 19 21:04:01 localhost crond[65785]: (root) PAM ERROR (Authentication failure)
Sep 19 21:04:01 localhost crond[65785]: (root) FAILED to authorize user with PAM (Authentication failure)
Sep 19 21:05:01 localhost crond[65892]: (root) PAM ERROR (Authentication failure)
Sep 19 21:05:01 localhost crond[65892]: (root) FAILED to authorize user with PAM (Authentication failure)

root密码设置永不过期

chage -l root
Last password change                    : never
Password expires                    : never
Password inactive                   : never
Account expires                     : never
Minimum number of days between password change      : 0
Maximum number of days between password change      : 90
Number of days of warning before password expires   : 7

我几次重启crond没什么帮助。

任何帮助非常感谢。

1 个答案:

答案 0 :(得分:0)

请参阅https://serverfault.com/questions/620157/how-to-fix-a-crontab-access-issue-with-a-pam-configuration-error-message以获取解决方案。

似乎你不应该在access.conf中评论root。 同一链接中还有其他解决方案

希望它能解决你的问题。