Is it possible to make a Bash file run as root in crontab? [closed] Is it possible to make a Bash file run as root in crontab? [closed] bash bash

Is it possible to make a Bash file run as root in crontab? [closed]


Yes, just add it to the root users' crontab; run the crontab -e command.

The places cron stores its files can be a little bizzare, so use the crontab -e command which will make sure it's in the right place, and I believe it checks the syntax.


You can just do

crontab -e

as root.


Just specify root as the user for the entry in /etc/crontab:

0 0 *  * *  root  somecommand

Alternatively you can also add the command to root's personal crontab by using crontab -e as root.