title: Confusing file permissions issues when uploading wordpress plugins
body: <p>I'm on my own Ubuntu box on AWS. I have two users: medsyd (the owner of my wordpress site) and www-data (which apache runs as). For now, to try get things working, I've added both to each other's groups - so www-data belongs to the medsyd group, and medsyd belongs to the www-data group.</p>
  
  <p>I'm trying to make it so that wordpress can upload/install plugins without asking for FTP access. I can upload images/media just fine - but plugins seem to be behaving really weirdly and not following what I would expect given the file permissions.</p>
  
  <p>Here's what I've tried:</p>
  
  <ol>
  <li><p>medsyd:medsyd as the owner of the site directory and all it's contents; 775 directories, 664 files. Wordpress asks for FTP. Why? (the www-data user should be able to write/read the correct files since it belongs to the medsyd group)</p></li>
  <li><p>medsyd:www-data as the owner of the site directory and all it's contents; 775 directories, 664 files. Wordpress asks for FTP. Why? (the www-data user should be able to write to read/write the correct files, since the files all belong to the www-data group)</p></li>
  <li><p>www-data:www-data as the owner of the site directory and all it's contents; 775 directories, 664 files. Wordpress does NOT ask for FTP. YAY. But www-data shouldn't own all my files.</p></li>
  <li><p>www-data:www-data as the owner of the wp-content directory (and all it's contents) ONLY (everything else outside wp-content owned by medsyd:medsyd); 775 directories, 664 files. Wordpress ASKS for FTP. (Why does this differ from the example just above, which worked, where www-data owns everything outside the wp-content directory aswell?)</p></li>
  </ol>
  
  <p>What logic does wordpress use to decide whether or not to ask for FTP when installing plugins? I can't seem to think of any that would reconcile with the 4 examples above.</p>
  
  <p>Edit: I understand there are other ways around this - eg changing the user apache runs as, storing FTP credentials in wp-config etc, but regardless, I really what to understand why the permissions I'm using above aren't behaving as expected.</p>