Each user has their own cron file including the root user. If the cron task requires administrative privilege then it can be added to the root cron task file. For more details on cron tasks, the can run the commands man crontab
crontab -e
You can switch to the root user and run the above command on Ubuntu/Debian we can use the sudo command to edit the root user’s cron task
sudo crontab -e
#list crontab(printed to the output/screen)
crontab -l
#edit crontab
crontab -e
#remove crontab
crontab -r
Crontab Format
minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command
minute hour day month weekday command
every day at 5:21 am
21 05 * * * /usr/bin/somedirectory/somecommand
every day at 5:21 pm
21 17 * * * /usr/bin/somedirectory/somecommand
Run at every minute interval pass the hour
*/10 * * * * /usr/bin/somedirectory/somecommand
Every hour on the dot and at 10,20,30,40,50 past the hour
0,10,20,30,40,50 * * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours(note the comma. 0,31) in the 4:00 am and 5:00 am an hour on the 1st through the 15th of every January and June(note the comma again).
01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
If the /etc/cron.allow file exists, then users must be listed in it in order to be allowed to run the crontab command. If the /etc/cron.allow file does not exist but the /etc/cron.deny file does, then users must not be listed in the /etc/cron.denyfile in order to run crontab. In the case where neither file exists, the default on current Ubuntu (and Debian, but not some other Linux and UNIX systems) is to allow all users to run jobs with crontab. For more information crontab see: https://help.ubuntu.com/community/CronHowto