 <p>OK, this is not a python but a UNIX problem: </p> <p>A file is, by default, always created owned by the user of the creating process.</p> <p>As root, you can change your effective UID for such operation, and you can change the file ownership afterwards.</p> <p><code>cp</code> supports keeping the original owner: <code>cp -a</code> This might already solve your problem.</p> <p>Setting the UID in your python process is really trivial:</p> <pre><code>import os os.setuid(&lt;userid&gt;) </code></pre>