1

Content of 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)

I'm getting the above error of cron status for yum-cron(BAD FILE MODE).

1

cronie (the cron in question), does a specific check for file permissions on each crontab file, at:

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

The mask it uses is 533 and the resulting masked permissions must be 400, which means that it will allow read (4) or read/write (4+2) bits for the owner of the file, and no more than read (4) for group and other.

Some visual examples:

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)

You most likely have writable-bits on the file somewhere; some possible fixes are:

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

Reference:

2
  • I'm no longer getting bad file name but now when I check /var/spool/mail/root......./bin/sh: /etc/cron.d/0yum.cron: says Permission denied – fball4life36 Feb 21 '18 at 19:42
  • Perhaps we should wrap up this question (solved the bad file mode), and open a new question regarding the cron sh error. – Jeff Schaller Feb 21 '18 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.