On my server I have set up several user accounts for different purposes to separate my personal websites from my semi-pro websites.
Some of these websites are WordPress sites and I’m trying to enable image upload. The files in the home directory are obviously owned by that specific user however, I have added Apache (www-data) to the group of that user so in theory if I give a directory and it’s contents
chmod -R g+w then that directory should be writable by Apache (and the PHP process), correct?
As you might understand, this is not whats currently happening and I’m not sure how to make this work. What I don’t want is to assign all the files to belong to www-data and then add the user to the www-data group. I believe the files should belong to the user first and foremost and www-data has only limited permissions.
What would be the best way to fix and/or troubleshoot this?
Thanks for the responses so far, what I’d like to point is that on my development machine (Ubuntu) I have the exact same set up. Eclipse projects are stored in a sub-directory of my home directory and simply by doing a
chmod -R g+w on required directories I have the PHP process under Apache write to those directories. I’m not using any ACL’s what so ever for this.
However, for some reason on my server this is not working which is a bit puzzling.
What might be a difference between my dev machine and my server is that on my dev machine files are like this:
-rw-r--r-- 1 luke luke 34 2012-11-14 04:30 .some.file
And on my server this looks like:
-rw-r--r-- 1 luke wheel 34 2012-11-14 04:30 .some.file
I guess the group here has an influence.
I prefer to use ACLs for this. For instance:
setfacl -R -m user:www-data:rwx,d:user:www-data:rwx /home/luke/www.luke.com/wp-content/uploads
www-data user full access to the uploads directory and everything below it.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.