I'm running a website on 10.04 and am not sure how to set up my crontab. Should I create it under root or a user such as www-data? Python, Postgres, Nginx.

  • What's are the commands you are going to run? At least a general description of the tasks will help us answer this one.
    – belacqua
    Apr 2, 2011 at 0:18
  • Sorry, should have provided more info. It's basically just to run some scripts through my Python framework such as a mail queue. So it sounds like www-data might be the best choice. I'm just completely confused on if I should be administering my servers as root or as a user. Can't seem to find very definitive answers. I'm doing pretty much run-of-the-mill web serving. Apr 3, 2011 at 5:18

1 Answer 1


JGBelacqua has a good point, the context of your cron-user depends on the task. Does it really require root permissions to run? If the specified task does not require any elevated privileges you are probably better off running it as the WWW service user www-data.

The big idea here, is if you need to access parts of the system that are unavailable to www-data, (and for good reason) then its safe to setup the crontab as your root user. Just make sure that if you're moving files about that you associate the proper chown/ghgrp commands so www-data can access them (respectively if they need to be accessed by the www-service)

To illustrate with an example, I run nightly database backups of my pgSQL and MySQL databases with a fairly thorough PHP script. Its executed by my www-data user as it compresses, archives, and posts them to a management web-interface. Thus it needs to be accessible by www-data. If i didn't need this to happen; say I were to copy a nightly snapshot of my website to a directory i didn't want my normal users to have access to, I would run this as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.