1

I have a file in /etc/cron.d with 606 permissions to be run by root.

The intention is to provide read & write access to 'others' via 606 to allow a script to modify the file.

Cron does not want to run it and provides a "(root) BAD FILE MODE" message.

I have discovered that Cron is picky with file permissions and that using 640 or 644 permissions would be more acceptable, but then a script wouldn't be able to edit it.

Is there any way that cron can be configured to accept 606? Alternatively, is there any way a script could modify a cron file without root privileges?

Thank you

  • non-root users (or their scripts) should never be able to modify scripts that are run by root. crond is protecting you from yourself. – cas Jun 8 '16 at 4:51
2

Each user has its own crontab. By allowing the non-root users to write a root's crontab you make a security breach in your system, this is why crond rejects a file with such permissions.

If you need to allow non-root accounts to perform some actions that require root privileges then consider to use sudo

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.