Setting up a cron job that does a chmod/chown

sudo should almost never be used in scheduled tasks. It expects to be able to talk to a terminal, and requires specific flags to avoid trying to do so.

Create your cron job as root (in /etc/crontab - Note that the format of this file is slightly different: minute hour mday month wdayusercommand) instead.
This also has the benefit of working on systems where sudo isn't installed.


You want your root cron script (edit by running sudo crontab -e) to be:

 55 * * * * /bin/chown -R somename /home/somename/Dropbox && /bin/chmod u+rw /home/somename/Dropbox

Assuming the user is named somename and that /home/somename/Dropbox is the full path of your Dropbox directory. As root user, ~ goes to /root.


Two issues:

1) Paths aren't normally set up in cron the same way they are when you log in. Try /usr/bin/sudo /bin/chown ... (or whatever the right paths are to those programs on your system).

2) sudo normally asks for your password, or may otherwise not be happy running noninteractively. I suggest you put the commands in root's crontab without the sudo instead, then the commands run as root.