title: user www-data cannot remove file
body: <p>In php I do the following:</p>
  
  <pre><code>exec('remove_file.sh', $output, $return);
  </code></pre>
  
  <p>where remove_file.sh is the following script:</p>
  
  <pre><code>#!/bin/sh
  rm -f /tmp/test.pdf
  </code></pre>
  
  <p>I verified that this script is run by www-data and test.pdf is owned by myuser but with 666 (rw-rw-rw-) permissions. /tmp is owned by root and has 666 permission.</p>
  
  <p>The script returns 1 (general error) without any output.</p>
  
  <p>If I try from a terminal:</p>
  
  <pre><code>sudo su www-data -c 'rm -f /tmp/test.pdf'
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>cannot remove `/tmp/test.pdf': Operation not permitted
  </code></pre>
  
  <p>How can I remove this file from a php script?</p>