You (oracle) are not allowed to access to (crontab) because of pam configuration 错误处理
只有cron.deny 文件,但文件无内容,不存在限制(如果存在cron.allow文件,以cron.allow文件优先;果如cron.allow和cron.deny都存在,以cron.allow文件优先;如果只有cron.deny 文件,只能以cron.deny 文件为准)怀疑可能是因Oracle用户设置了有效期导致 crontab -e 出错。再次执行crontab -e ,错误消除。
一、问题说明
Linux 服务器在 Oracle 用户下执行 crontab -e 报错,如下:
$ crontab -e
You (oracle) are not allowed to access to (crontab) because of pam configuration.
二、问题排查
1、查看/bin/crontab的SSID位是否标记S
# ll /bin/crontab
-rwsr-xr-x. 1 root root 57576 May 16 2023 /bin/crontab

2、检查cron
# ll -dl /etc/cron*
drwxr-xr-x. 2 root root 54 Jul 26 2024 /etc/cron.d
drwxr-xr-x. 2 root root 57 Jul 26 2024 /etc/cron.daily
-rw-------. 1 root root 0 May 16 2023 /etc/cron.deny
drwxr-xr-x. 2 root root 41 Jul 26 2024 /etc/cron.hourly
drwxr-xr-x. 2 root root 6 Jun 10 2014 /etc/cron.monthly
-rw-r--r--. 1 root root 451 Jun 10 2014 /etc/crontab
drwxr-xr-x. 2 root root 6 Jun 10 2014 /etc/cron.weekly

只有cron.deny 文件,但文件无内容,不存在限制(如果存在cron.allow文件,以cron.allow文件优先;果如cron.allow和cron.deny都存在,以cron.allow文件优先;如果只有cron.deny 文件,只能以cron.deny 文件为准)
3、检查PAM模块,cat /etc/pam.d/crond
# 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 system-auth
session required pam_loginuid.so
session include system-auth
auth include system-auth
文件配置正常
4、查看系统日志,cat /var/log/secure
看到如下字样:
# cat /var/log/secure
Feb 21 15:50:18 MESDBPOC05 crontab: pam_unix(crond:account): expired password for user oracle (password aged)

怀疑可能是因Oracle用户设置了有效期导致 crontab -e 出错。
5、查看oracle用户密码有效期
发现过期时间为90天:
# chage -l oracle
Last password change : Jul 26, 2024
Password expires : Oct 24, 2024
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
三、问题处理
1、修改oracle密码永不过期
# chage -M 99999 -W 7 oracle
修改后再次查看oracle用户密码有效期:
# chage -l oracle
Last password change : Jul 26, 2024
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
四、效果验证
再次执行crontab -e ,错误消除。
参考:
https://www.cnblogs.com/leihongnu/p/13073946.html
https://blog.csdn.net/promise524/article/details/143030731
https://blog.csdn.net/weixin_44147924/article/details/128151236
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)