Search code examples
linuxsymfonydebianfile-permissions

Linux folder permissions not inherited with symfony new project


I'm setting up a new web server, and getting some issues with folder perms when generating a new symfony project.

All my websites are located into /var/www
My symfony installer is located in /usr/local/bin/symfony
And this my my symfony installer ownership and perms:
-rwxr-xr-x 1 root staff 233229 Oct 11 00:56 symfony

Here is what I did on my website main folder :
chown :www-data /var/www/
chmod g+s /var/www/
setfacl u:my-user:rwx,d:u:my-user:rwx,g:www-data:rwx,d:g:www-data:rwx /var/www

When uploading file, everything is fine, group and perms are inherited correctly.

The problem is when I generate a new symfony project with the following command while located into /var/www:
symfony new my_project

This is the project folder perms:
drwxr-xr-x 9 501 root 4096 Oct 15 00:20 test

And the perms inside the project folder:
drwxr-xr-x 4 501 staff 4096 Oct 15 00:20 app
drwxr-xr-x 2 501 staff 4096 Oct 15 00:20 bin
-rw-rw-rw- 1 root root 2032 Oct 15 00:20 composer.json
-rw-rw-rw- 1 root root 74614 Oct 15 00:20 composer.lock
-rw-rw-rw- 1 root root 248 Oct 15 00:20 .gitignore
-rw-r--r-- 1 501 staff 978 Oct 3 21:12 phpunit.xml.dist
-rw-rw-rw- 1 root root 68 Oct 15 00:20 README.md
drwxr-xr-x 3 501 staff 4096 Oct 15 00:20 src
drwxr-xr-x 3 501 staff 4096 Oct 15 00:20 tests
drwxr-xr-x 5 501 staff 4096 Oct 15 00:20 var
drwxr-xr-x 15 501 root 4096 Oct 15 00:20 vendor
drwxr-xr-x 3 501 staff 4096 Oct 3 21:14 web

ACL aren't inherited at all. After a lookup, 501 seems to be the daemon user.

How can I fix this issue?


Solution

  • You need to use recursive Preciel.

    Try:

    setfacl -R ...
    

    Also the commands you used sets the permission for /var/www, but nothing underneath that!