用户无法访问 crontab

用户无法访问 crontab

甲骨文Linux 5.10

root 用户可以访问 crontrab,但不能访问任何其他用户。没有/etc/cron.allow,并且/etc/cron.deny是一个空文件。

使用 Oracle 用户帐户:

[oracle@dub-ImrORA2 ~]$ crontab -e

Authentication failure
You (oracle) are not allowed to access to (crontab) because of pam configuration.

/etc/pam.d/crond listing:

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

crond在跑

[root@dub-ImrORA2 pam.d]# ps -aef | grep cron
root      3559     1  0 Jan29 ?        00:00:05 crond
root     25518 25279  0 13:19 pts/2    00:00:00 grep cron

权限crontab

[root@dub-ImrORA2 ]# ls -al /usr/bin/crontab
-rwxr-xr-x 1 root root 315640 Dec 20  2011 /usr/bin/crontab

权限/var/spool/cron/oracle

[root@dub-ImrORA2 ]# ls -al /var/spool/cron/oracle
-rw------- 1 root root 125 Feb 24 11:43 /var/spool/cron/oracle

答案1

问题已解决:

更改 /usr/bin/crontab 的权限

[root@dub-ImrORA2 log]# ls -al /usr/bin/crontab
-rwxr-xr-x 1 root root 315640 Dec 20  2011 /usr/bin/crontab

[root@dub-ImrORA2 log]# chmod 4775 /usr/bin/crontab
[root@dub-ImrORA2 log]# ls -al /usr/bin/crontab
-rwsrwxr-x 1 root root 315640 Dec 20  2011 /usr/bin/crontab

更改 /var/spool/cron/oracle 上的所有者

[root@dub-ImrORA2 spool]# cd /var/spool/cron
[root@dub-ImrORA2 cron]# ls -al
total 24
drwx------  2 root root 4096 Feb 24 11:43 .
drwxr-xr-x 13 root root 4096 Feb 13  2014 ..
-rw-------  1 root root  125 Feb 24 11:43 oracle

[root@dub-ImrORA2 cron]# chown oracle:root oracle
[root@dub-ImrORA2 cron]# ls -al
total 24
drwx------  2 root   root 4096 Feb 24 11:43 .
drwxr-xr-x 13 root   root 4096 Feb 13  2014 ..
-rw-------  1 oracle root  125 Feb 24 11:43 oracle

证明

[root@dub-ImrORA2 cron]# su - oracle
[oracle@dub-ImrORA2 ~]$ crontab -l
55 23 * * 0-4 /home/oracle/scripts/tblspc_usage_rpt.sh >> /home/oracle/scripts/tblspc_usage.log 2>&1

答案2

只需pam_access.so在评论区发表评论即可/etc/pam.d/cron

答案3

我遇到了这个问题,结果发现这是因为我的 sssd 守护进程被禁用了。启动(并启用)sssd 是修复方法。

相关内容