title: run crontab as www-data to create a file with www-data as owner
body: <p>I want to run a crontab command every 5 mins that executes a py script.
  The py script inturn generates a log file  with midnight rotation within /var/www/logs/.The logs dir has 777 permission.</p>
  
  <p>The log file has midnight rotation and when new file is created,it creates as root owner.How to ensure the ownership stays as www-data as some other scripts also write to the same file and having root ownership causes permission issue for other scripts.</p>
  
  <p>One way is to put the command in,</p>
  
  <p><code>crontab -u www-data -e</code> </p>
  
  <p>This works fine, but i want to maintain all my cron commands under root user.</p>
  
  <p>I tried doing the same with sudo, but it creates with root as owner which not what i want.</p>