Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am setting up Apache hosting multiple sub-domains with different developers. There is a folder for each sub-domain, and I want to have a group that is able to write and edit these files (developer group). I would also like it to be so that other people would not be able to read nor see the files (o-rwx). As I've been reading that SFTP is recommended over FTP due to security reasons, I'd like to use it for uploading/editing the files.

Say I have folders as follows

website1 - developer group: web-dev1
website2 - developer group: web-dev2

I thought of setting the following permissions for all files:

www-data:web-dev1/web-dev2 r-xrwx---

It seems to work, but when a file is created it has the wrong permissions and it cannot be edited by the group nor executed by Apache.

I did some research and tried the following:

sudo chown www-data:web-dev1 website1 -R
sudo chmod 570 website1 -R
sudo chmod g+s website1 -R
sudo setfacl -d -m u:www-data:rx website1
sudo setfacl -d -m g::rwx website1
sudo setfacl -d -m o::0 website1

And checking the defaults

getfacl website1
# file: website1/
# owner: www-data
# group: web-dev1
# flags: -s-
user::r-x
group::rwx
other::---
default:user::r-x
default:user:www-data:r-x
default:group::rwx
default:mask::rwx
default:other::---

This, however, does not really work. If I create a folder there, it will have the correct permissions (dr-xrws---+), but is owned by myuser:web-dev1 instead of www-data:web-dev1

The files have the same issue with the owner, but also have incorrect permissions (-r--rw----+).

Should I try another approach, or is there a way to set the default permissions and owner properly?

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.