• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to allow only specific non-root user(s) to use crontab

by admin

From the manpage of crontab command:

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

So touching an empty file /etc/cron.allow can deny all non-root user to use crontab. Make sure that there is no empty /etc/cron.deny file present. This may create a conflict.

# touch /etc/cron.allow

To allow a user or some users to use crontab, append the user name(s) into the file and make sure one user per line, i.e allow user “test1” and “test2” to use crontab:

# echo "test1"  > /etc/cron.allow
# echo "test2" >> /etc/cron.allow

Verify the cron access by creating the crontab entry for the use :

# su - test1
$ crontab -e
# su - test2
$ crontab -e

Filed Under: Linux, Solaris

Some more articles you might also be interested in …

  1. watch Command Examples in Linux
  2. zypper: command not found
  3. acountry Command Examples in Linux
  4. Linux OS Service ‘ldap’
  5. datamash Command Examples in Linux
  6. How to configure CentOS/RHEL 6 system to not used last 3 passwords used
  7. How to Partition DM-Multipath Pseudo Devices in CentOS/RHEL
  8. i3-scrot Command Examples in Linux
  9. YUM command examples to install, remove and upgrade packages
  10. ssh-keygen: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright