linux crontab報以下錯誤解決
[root@china ~]# crontab -l
拒絕權限
You (root) are not allowed to access to (crontab) because of pam configuration.
解決:
1.查看定時任務的日志/var/log/cron
pam_access(crond:account): access denied for user `root' from `cron'
2. 查看 /etc/pam.d/crond
root>more /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
修改文件:
[root@~]# cp /etc/pam.d/crond /etc/pam.d/crond.bak
[root@ ~]# vim /etc/pam.d/crond
account sufficient pam_access.so account include system-auth session sufficient pam_loginuid.so session include system-auth auth sufficient pam_rootok.so auth required pam_env.so auth include system-auth
重啟crond
[root@~]# /etc/init.d/crond restart
停止 crond: [確定]
正在啟動 crond: [確定]
重新登錄root
[root@~]# crontab -e
完美解決