title: What are the best practices setting file permissions for a PHP website on Apache2/Linux (LAMP)?
body: <p>What is the minimum permissions to set the site files to, in order to allow apache2/php to execute code, show html/css/js, and for some files update settings download and install plugins.</p>
  
  <p>The websites I am building are either Drupal or Wordpress.</p>
  
  <p>I'd like to set permissions so that <code>www-data</code> has the minimum permissions and the admin (which is me for now) has permissions to allow him to do tasks from an SSH session without needing <code>sudo</code>.</p>
  
  <p>[Edit]
  I'd like to add that I have full access to the LAMP server via SSH. What I am after is the most restrictive and hence the most secure way to set user and group permissions, so in short:</p>
  
  <ul>
  <li>What group</li>
  <li>What owner</li>
  <li>What permissions</li>
  </ul>
  
  <p>For all site files for say a wordpress
  In order to achieve</p>
  
  <ul>
  <li>Apache can access the files and execute PHP</li>
  <li>For some special files or folders the Wordpress should be able to change</li>
  <li>The admin can easily change files without having to use sudo</li>
  </ul>