我这样做时收到此错误。
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 日志
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 几次没有任何帮助。
非常感谢任何帮助。
看来你不应该在access.conf中注释root。 同一链接中还有其他解决方案
希望它能解决您的问题。
好吧,我在爱立信 ePG 上配置 crond 时也遇到了这个问题 - 它根本没有 crond。
因此,为了解决报告的问题,pam 和 crontab 我创建了文件 /etc/pam.d/crond,其内容为:
#
# The PAM configuration file for the cron daemon
#
#
auth sufficient pam_env.so
auth required pam_rootok.so
auth include system-auth
account required pam_access.so
account include system-auth
session required pam_loginuid.so
session include system-auth
非常重要的是第一行未注释的“足够”与“必需”。