title: Ubuntu allow www-data to write to new files
body: <p>How to allow www-data group on Ubuntu to write into new just created files by www-data?</p>
  
  <p>I'm using a PHP script and it creates a file (owner is www-data), and after that  I need to write to this file. But it failed, I think because www-date hasn't write access to new file.</p>
  
  <p>And provide all access to all users to the directory where this file need to  be created but it doesn't work because new file is created by www-data so it doesn't have permission to write.</p>
  
  <p>My script:</p>
  
  <pre><code>crontab -l &gt; file &amp;&amp; echo \"test\" &gt;&gt; file
  </code></pre>