I'm running an Apache setup on Arch Linux (Apache runs as user http, group http). The document root is under /srv/http. I've added my user (ben) to the http group, and chowned /srv/http to http:http. No matter what I try, when I chown this directory to http:http, my user, ben, cannot access it. When attempting to cd into /srv/http, I get permission denied. I've even tried running chmod 777 on /srv/http but I still cannot access it. Is there something I'm missing here?
1 Answer
Ben is a member of two or more groups; the primary group is used by default. To select the 'http' group membership to write files during a shell session Ben can use:
newgrp http
To change the mode of the directory to read-write for the group http, to automatically use the http group to own the files set the 'group-bit' on the directory. Then Ben can also transfer files and it will be taken care of automatically:
chmod 2770 /srv/http
To change group ownership recursively use:
chmod -R g+rwx /srv/http