Monday, December 8, 2014

How to Deny / Allow user for Cron Job Access

If the /etc/cron.allow file exists, then you must be listed (one user per line) therein in order to be allowed to use this command.

If the /etc/cron.allow file does not exist but the /etc/cron.deny file does exist, then you must not be listed in the /etc/cron.deny file in order to use this
command.

<Scenario when user invisible is not in allow list, or appears in deny list>
$ crontab -e
You (invisible) are not allowed to use this program (crontab)
See crontab(1) for more information



Observation

If both the file exists, and same user appears in both cron.allow and cron.deny files, then user will able to edit crontab file.

If both the file exists, and same user doesn't appear in any of  cron.allow and cron.deny files, then user will not able to edit crontab file.

Note: Make sure to create an entry for the user in /etc/shadow file else user will not have the crontab operation ability. By default we have this entry made with adduser command.

No comments:

Post a Comment