Running cron under sudo

Brian McKee brian.mckee at
Tue Oct 7 15:50:02 UTC 2008

On Tue, Oct 7, 2008 at 11:38 AM, Homer <fsunoles at> wrote:
> Ubuntu Server 8.04
> I can get cron to work as a regular user, but not sudo.  For example:
> 23 8 * * * cp /root/test /root/test1
> will not run under sudo, but a similar cron will run as a regular user.
> 23 8 * * * cp /home/user/test /home/user/test1
> I'm entering sudo's cron with "sudo crontab -e"

Try sudo su -  and then crontab -e  or sudo crontab -u root -e

>From the man page
> If the -u option is given, it specifies the name of the user
> whose crontab is to be tweaked.  If this option is not given, crontab examines
> "your" crontab, i.e.,  the  crontab  of  the person executing the command.
> Note that su(8) can confuse crontab and that if you are running inside of su(8)
> you should always use the -u option for safety's sake.

More information about the ubuntu-users mailing list