Linux

錯誤的文件模式 yum-cron

  • February 21, 2018

內容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 狀態錯誤(錯誤文件模式)。

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

參考:

引用自:https://unix.stackexchange.com/questions/425686