local wordpress installation, plugin installation and file permissions

Solution 1:

It sounds like you've already got it figured out, but I'll let you know how I did it. This set up lets me and apache write to the wordpress directory, and the plugin/theme/upgrade works fine from within Wordpress.

First, I made my user part of the www-data group: sudo usermod -G www-data -a <user>.

Next, I made the entire wordpress directory owned by www-data:www-data: sudo chown -R www-data:www-data wordpress. I also made all the files readable and writable by user and group: find wordpress -type f -exec chmod 664 {} +, find wordpress -type d -exec chmod 775 {} +.

Finally, I set the guid bit so that new files would also be group-owned by www-data: chmod -R g+s wordpress.

Now, this isn't the most secure setup. Any vulnerabilities in Wordpress could be used to write to files within your wordpress installation. But I, personally, have never had any problems. And when I tried to make it less restrictive, updates and theme/plugin installation from within Wordpress Admin usually broke. I never quite found the right sweet spot between security and usability.