title: Running python cron script as non-root user
body: <p>I have a small problem running a python script as a specific user account in my CentOS 6 box.</p>
  
  <p>My cron.d/cronfile looks like this:</p>
  
  <p><code>5 17 * * * reports /usr/local/bin/report.py &gt; /var/log/report.log 2&gt;&amp;1</code></p>
  
  <p>The account <code>reports</code> exists and all the files that are to be accessed by that script are <code>chowned</code> and <code>chgrped</code> to <code>reports</code>. The python script is <code>chmod a+r</code>. The python script starts with a <code>#!/usr/bin/env python</code>.</p>
  
  <p>But this is not the problem. The problem is that I see nothing in the logfile. The python script doesn't even start to run! Any ideas why this might be?</p>
  
  <p>If I change the user to <code>root</code> instead of <code>reports</code> in the cronfile, it runs fine. However I cannot run it as <code>root</code> in production servers.</p>
  
  <p>If you have any questions please ask :)</p>
  
  <p>/e:
  If I do <code>sudo -u reports python report.py</code> it works fine.</p>