System Administration Guide: Advanced Administration

How to Limit crontab Access to Specified Users

  1. Become superuser.

  2. Create the /etc/cron.d/cron.allow file.

  3. Enter the root user name into the cron.allow file.

    If you do not add root to the file, superuser access to crontab commands will be denied.

  4. Enter the user names, one per line, that will be allowed to use the crontab command.


    root
    username1
    username2
    username3
    .
    .
    .
    

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 the crontab command.


$ cat /etc/cron.d/cron.denydaemon
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 can access the crontab command.


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