Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

I've got the following scenario:
There's a folder named "uploads". It's owned by "root" and it's group is "webmasters". Permissions are set to 755.

drwxrwsr-x  2 root webmasters 4096 Mar 20 22:49 upgrade

With this setup I'm not able to create files by php in "upgrade". If I change permissions to 777 I'm able to create files in upgrade.

But the case is this:
My Apache runs as www-data. So I added the webmaster group as primary group to the user www-data.

root@mymachine: /var/www# id www-data
uid=33(www-data) gid=1002(webmasters) groups=1002(webmasters),33(www-data)

So why need I set the permissions of "upgrade" to 777? If the folder "upgrade" has the group "webmasters" and the user "www-data" has the group/is in the group webmasters and the permissions are set to 775 then all group members of webmasters should get the "7" permissions and should be able to read, write and execute.

I already restarted my machine, so I'm sure that all groups assignments are correctly recognized by the system. So what am I doing wrong?

edit:// When I change the group from "webmasters" to "www-data" I get write permissions with 775. When I switch back the group to webmasters it doesn't work. The question is why? The user www-data is in both groups - www-data and webmasters.

share|improve this question

marked as duplicate by Michael Hampton, mdpc, Jenny D, Khaled, dunxd Mar 28 '13 at 11:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer 1

Apache is running as the www-data user and the www-data group. The group is explicitly specified in its config and adding the user to more groups won't affect this.

You can change the group that Apache runs as in its httpd.conf. See http://docs.oseems.com/general/application/apache/change-user-and-group for more info.

share|improve this answer
    
My httpd.conf is completely empty. I'm running "apache2-mpm-worker". I've found the Apache's user and group in /etc/apache2/envvars and changed the group to "webmasters". After that I restarted Apache with "service apache2 restart". Nevertheless my problem still exists. –  netblognet Mar 20 '13 at 23:45
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.