Hostxpeed
Login Get Started →
Security

How to Restrict Cron Jobs to Root Only

4 min read
26 views
Jun 10, 2026

Step 1: Create cron.allow File

sudo touch /etc/cron.allow
sudo chmod 644 /etc/cron.allow

Step 2: Add Root Only

echo "root" | sudo tee /etc/cron.allow

Step 3: Ensure cron.deny Exists (Optional)

sudo touch /etc/cron.deny

Step 4: Remove Other Users from cron.allow

sudo nano /etc/cron.allow

Step 5: Test

crontab -l  # should work for root only
sudo -u username crontab -l # should fail

Was this article helpful?