This question already has an answer here:

I'm trying to setup a web folder on LAMP with Ubuntu 14.04 where :

  1. Apache/PHP can read everything inside. (r-x for folders and r-- for files)
  2. Multiple users in a "devs" group can do anything inside. (rwx for folders and rw- for files)
  3. Newly created folders and files have the same properties as above.

I know there is this answer that looked pretty good at first, until i tried to access from the web and i got a 403 permission denied.

Should i use only one "dev" user that can modify the web folder ?

I could also use ACL ?

EDIT : Not a duplicate of https://serverfault.com/a/357109/354883 because it doesn't solve the problem for newly created files.

MY SOLUTION: Since i didn't found anything on the standard permission system that could do exactly what i wanted, i checked ACL.

What i did:

  • sudo apt-get install acl You also may wanna mount your parition so it enables ACL
  • sudo setfacl -Rm g:coders:rwx,g:www-data:r-x,o:--- webfolder
  • sudo setfacl -Rm d:g:coders:rwx,d:g:www-data:r-x,d:o:--- webfolder

marked as duplicate by yoonix, Iain, womble May 18 '16 at 4:31

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.

  • @Iain I explained why it isn't. – Maarethyu May 17 '16 at 9:47
  • 1
    The section headed "Default new file permissions" seems to cover newly created files. – womble May 18 '16 at 4:31

For Apache and users of the group "dev" have permission to do anything you should:

Includes users who belong to the group "dev" www-data group, and add the www-data user in the group "dev"

Change the umask default Apache and users of the group "dev"

  1. Add or edit /etc/apache2/envvars

    umask 002

    /etc/init.d/apache2 restart

  2. Add or edit ~/.bashrc you users (or enhance it)

    umask 002

    chmod 775 -R webfolder

Note: Note that this way all users who belong to "dev" will have privileges to modify files created by all users "dev". It can be dangerous for your structure

  • Doesn't this make the apache and php able to write on all files ? – Maarethyu May 17 '16 at 9:49

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