I've set up a VM with Debian7 for PHP development.

Since PHP needs to write to log files and the like, the www-data group needs write permissions on /var/www/...

I found a good answer here on superuser that makes it go real quick: https://superuser.com/a/19333

However, when I update a project with composer and new cache/log files are created, www-data does not have permission to write to them and I have to execute the last 2 commands again.

I was under the impression that setting permissions to 2775 meant that all future files would have the 775 permission? Or am I wrong about that? Is there a way to prevent having to reset the permissions every time or am I stuck having to do this?

Granted, it's not something that happens often, I'm just curious if there's a way to avoid it, other than setting up a cron job for it.


I think this is what you are looking for. This answer describes how to use Access control lists (ACLs) for default permission settings for new files/folders, within a given folder. This is also part of the second answer of the link you provided, where Nikhil Chelliah states the following within his answer:

The setfacl command accepts -s to replace an existing ACL or -m to modify it; -R to make directory ACLs recursive; and -d to make the specified settings the default, which is useful if you're anticipating forthcoming user accounts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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