重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 452|回复: 0
打印 上一主题 下一主题

[基础命令] You (oracle) are not allowed to access to (crontab) becaus of pam configuration.

[复制链接]
跳转到指定楼层
楼主
发表于 2025-1-2 09:17:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 jiawang 于 2025-1-2 09:17 编辑

oracle用户下查看计划任务时,报错如下:
--查看计划任务
[oracle@sztech ~]$ crontab -l
You (oracle) are not allowed to access to (crontab) because of pam configuration.



按照常规流程排查下,顺序如下:

1)查看/bin/crontab的SSID位是否标记S

2)检查/etc/cron* 是否设置了.deny文件限制;

3)检查PAM模块,cat /etc/pam.d/crond,文件中配置是否正常

4)查看系统日志cat /var/log/secure的错误信息

5)查看oracle用户密码过期

查看/bin/crontab的SSID位是否标记S
[root@sztech ~]# ll /bin/crontab
-rwsr-xr-x. 1 root root 57664 Oct 16  2017 /bin/crontab


检查/etc/cron 是否设置了.deny文件限制*
[root@sztech ~]# ll -dl /etc/cron*
drwxr-xr-x. 2 root root 4096 Jan 13  2020 /etc/cron.d
drwxr-xr-x. 2 root root 4096 Jan 13  2020 /etc/cron.daily
-rw-------. 1 root root    0 Oct 16  2017 /etc/cron.deny
drwxr-xr-x. 2 root root 4096 Jan 13  2020 /etc/cron.hourly
drwxr-xr-x. 2 root root 4096 Dec 28  2013 /etc/cron.monthly
-rw-r--r--. 1 root root  451 Dec 28  2013 /etc/crontab
drwxr-xr-x. 2 root root 4096 Dec 28  2013 /etc/cron.weekly
有/etc/cron.deny文件,但没有实际内容,也就不存在什么限制。


注意:


如果存在cron.allow文件,以cron.allow文件优先;如果cron.allow和cron.deny都存在,以cron.allow文件优先;如果只有cron.deny 文件,只能以cron.deny 文件为准。


检查PAM模块,cat /etc/pam.d/crond,文件中配置是否正常
[root@sztech ~]# 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




查看系统日志cat /var/log/secure的错误信息
Mar 3 16:54:01 sztech crond[103891]: pam_unix(crond:account): expired password for user oracle (password aged)
Mar 3 16:54:25 sztech su: pam_unix(su-l:session): session opened for user root by root2(uid=1001)
Mar 3 16:55:47 sztech crontab: pam_unix(crond:account): expired password for user oracle (password aged)




Chage命令查看oracle用户密码有效期
--查看oracle用户密码有效期
[root@sztech ~]# chage -l oracle
Last password change : Aug 31, 2020
Password expires : Feb 27, 2023
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
Password expires : Feb 27, 2023部分,显示oracle的密码到期时间为Feb 27, 2023。


问题原因
oracle账号密码到期,导致oracle下的crontab的定时任务不能正常进行,所以产生如下报错:


[oracle@sztech ~]$ crontab -l
You (oracle) are not allowed to access to (crontab) because of pam configuration.
解决办法
修改oracle密码永不过期


--修改oracle密码永不过期
[root@sztech ~]# chage -M 99999 oracle

--chage -l oracle查看命令,再看密码过期时间为never
[root@sztech ~]# chage -l oracle
Last password change : Aug 31, 2020
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 10
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7Minimum number of days between password change : 10
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
经再次验证,oracle下的crontab命令可以正常编辑。



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2025-2-5 15:00 , Processed in 0.093229 second(s), 22 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表