How to Deny specific user from Running Cron jobs in Linux
In this Linux tutorial we are going to learn how deny specific user from running scheduled task using Linux cron job.
Every Linux user can add their own cron jobs using crontab -e command. But what if we want to disable specific user from running cronjobs ?
To block specific user from crontab, add the user's username to the /etc/cron.deny file.
Example
For example, let's think I have a user called jon in my Linux Server and I don't want the user jon to schedule task using crontab -e command. So all I have to do is add the user jon into /etc/cron.deny file.
If user tries to run crontab -e command, the user will receive following error message.
You (jon) are not allowed to use this program (crontab).
Another possibility is only allowing specific users to run cron jobs using /etc/cron.allow file. So the any Linux user not in the /etc/cron.allow file will be denied from adding cron jobs to the system.