6
3
Just started using setfacl
to assign permissions for a specific group to /var/www/html (CentOS 5). Files in this directory are 640, root:apache. However, I've noticed that after doing something like:
setfacl -R -m g:developers:rwx /var/www/html
setfacl -R -m d:g:developers:rwx /var/www/html
... ls -al
shows that a newly created file's owner and group are both set to my username.
Is there a way (using setfacl
) to enforce newly created files to get the permissions of the ACLs AND then set the owner:group to root:apache? Or, alternatively, is this best done through a periodic cron job that does a chown -R root.apache /var/www/html
down the entire DocumentRoot? Or... am I missing something else completely?
Maybe it's sufficient to ensure that all files that get created are owned and writable by group
developers
? You could do that by setting the setgid bit on/var/www/html
and using umask 002. – jjlin – 2012-06-11T21:40:20.8701The
setfacl -R -m d:g:developers:rwx /var/www/html
ensures that newly created files can be modified and deleted by anyone indevelopers
. setgid is great for allowing apache to still see the files - doing achmod g+s
on the directory forces newly created files to be owned by username:apache instead of username:username. The actual owner isn't much of a problem because the only users that should be in that directory are a) indevelopers
or b) root. Keeping/var/www/html
as 750, root:apache (with the setgid bit) ensures users outside ofdevelopers
can't get into the directory. – am4 – 2012-06-12T13:41:59.453