• 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. hwclock Command Examples in Linux
  2. What is Soft Links and Hard Links in Linux File System
  3. “Authorization not available. Check if polkit service is running or see debug message for more information” – CentOS/RHEL 7 ssh service error
  4. find WWN Number of HBA Card in Redhat Linux and CentOS
  5. CentOS / RHEL 6 : How to change the verbosity of debug logs during booting
  6. Linux “shutdown”, “poweroff”, “halt”, “reboot” Commands
  7. pvscan Command Examples in Linux
  8. Solaris Zone Install Fails With Cpio Error
  9. featureCounts: command not found
  10. How to Check the Size of the Yum Channels in Oracle Linux

You May Also Like

Primary Sidebar

Recent Posts

  • qemu-system-x86_64: command not found
  • timedatectl: command not found
  • mpirun.openmpi: command not found
  • startkde: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright