System Administration Guide

How to Limit crontab Access to Specified Users

  1. Become superuser.

  2. Use the editor of your choice to create a file named /etc/cron.d/cron.allow.

  3. Enter the user names, one per line, who will be allowed to use crontab commands.


    root
    username1
    username2
    username3
    .
    .
    .
    

    Be sure to add root to this list. If you do not, superuser access to crontab commands will be denied.

  4. Exit the file, saving the changes.

Examples--Limiting crontab Access to Specified Users

The following example shows a cron.deny file that prevents user names visitor, jones, and temp from accessing crontab.


$ cat /etc/cron.d/cron.deny
daemon
bin
smtp
nuucp
listen
nobody
noaccess
jones
temp
visitor

The following example shows a cron.allow file. The users smith, jones, lp, and root are the only ones who may access crontab.


$ cat /etc/cron.d/cron.allow
root
jones
lp
smith