错误文件模式 yum-cron

错误文件模式 yum-cron

内容service crond status -l

[root@test ~]# service crond status -l
Redirecting to /bin/systemctl status  -l crond.service
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor 
preset: enabled)
Active: active (running) since Mon 2018-01-15 13:34:58 EST; 1 months 6 days 
ago
Main PID: 831 (crond)
CGroup: /system.slice/crond.service
       └─831 /usr/sbin/crond -n


ORPHAN (no passwd entry)
(root) BAD FILE MODE (/etc/cron.d/yum-cron)

我收到上述 yum-cron(错误文件模式)的 cron 状态错误。

答案1

cronie(有问题的 cron)对每个 crontab 文件的文件权限进行特定检查,位于:

https://github.com/cronie-crond/cronie/blob/master/src/database.c#L96

它使用的掩码是 533,生成的掩码权限必须是 400,这意味着它将允许文件所有者读取 (4) 或读/写 (4+2) 位,且不超过读取 (4) 位对于团体和其他。

一些视觉示例:

user-readable
=====
r w x - human-readable permissions
4 2 1 - permission bit values
1 0 0 - file permissions are: readable only
1 0 1 - a mask of 5
=====
1 0 0 - OK -- resulting masked bits (4)

user-readable and writable
=====
r w x - human-readable permissions
4 2 1 - permission bit values
1 1 0 - file permissions are: readable and writable
1 0 1 - a mask of 5
=====
1 0 0 - OK -- resulting masked bits (4)

user-executable
=====
r w x - human-readable permissions
4 2 1 - permission bit values
0 0 1 - file permissions are: executable only
1 0 1 - a mask of 5
=====
0 0 1 - FAIL -- resulting masked bits (1)

group (or other) - readable
r w x - human-readable permissions
4 2 1 - permission bit values
1 0 0 - file permissions are: readable only
0 1 1 - a mask of 3
=====
0 0 0 - OK -- resulting masked bits (0)

group (or other) - readable and writable
r w x - human-readable permissions
4 2 1 - permission bit values
1 1 0 - file permissions are: readable and writable
0 1 1 - a mask of 3
=====
0 1 0 - FAIL -- resulting masked bits (2)

group (or other) - no permissions
r w x - human-readable permissions
4 2 1 - permission bit values
0 0 0 - file permissions are: no permissions
0 1 1 - a mask of 3
=====
0 0 0 - OK -- resulting masked bits (0)

您很可能在文件的某个地方有可写位;一些可能的修复方法是:

chmod 400 /etc/cron.d/yum-cron
chmod 600 /etc/cron.d/yum-cron
chmod 644 /etc/cron.d/yum-cron

参考:

相关内容