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

标签 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 日志

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 几次,但没有任何帮助。

非常感谢任何帮助。

最佳答案

请引用https://serverfault.com/questions/620157/how-to-fix-a-crontab-access-issue-with-a-pam-configuration-error-message寻求解决方案。

看来你不应该在access.conf中注释root。 同一链接中还有其他解决方案

希望它能解决您的问题。

关于linux - 由于 pam 配置,centOS 不允许您(root)访问(crontab),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46309800/

相关文章:

linux - 仅在日期为 > 使用 awk 时提取数据

regex - 使用sed over SSH使用正则表达式从文件中删除文本

bash - "[ $(command) ]"什么时候等于 "if command; then..."?

用Cron表达式每天在不同的时间运行两次?

node.js - 如何在heroku上的多个worker dyno上构建计划任务,其中每个worker dyno都处理一批不同的行

c# - 根据用户输入以编程方式创建 Hangfire cron 表达式

linux - 当我仅在c文件中插入任何模块时如何显示内核版本?

linux - 如果程序由 linux 命令屏幕启动,如何使程序从文件接收 "standard"输入?

linux - 在 bash 变量赋值中引用

linux - 如何在 Linux 上安全且事务性地替换文件?