I have some WordPress websites which have a good set of permissions on it. The problem I'm having is that WordPress is creating new folders (for example for plugins) which have a different set of user/groups:
ls -la /var/www/zorg.outsideit.net/public_html/wp-content/plugins total 56 drwxrwxr--+ 7 myuser g_w_zorg.outsideit.net 4096 Oct 26 22:46 . drwxrwxr-x 7 myuser g_w_zorg.outsideit.net 4096 Oct 26 19:57 .. drwxrwxr--+ 4 myuser g_w_zorg.outsideit.net 4096 Oct 17 19:36 better-wp-security drwxrwxr--+ 5 myuser g_w_zorg.outsideit.net 4096 Sep 27 21:36 gzip-ninja-speed-compression -rw-rwxr--+ 1 myuser g_w_zorg.outsideit.net 28 Sep 23 20:41 index.php drwxrwxr--+ 6 myuser g_w_zorg.outsideit.net 4096 Sep 27 21:35 stops-core-theme-and-plugin-updates drwxr-xr-x+ 4 apache apache 4096 Oct 26 22:44 theme-check drwxrwxr--+ 11 myuser g_w_zorg.outsideit.net 4096 Oct 20 15:42 wordpress-seo
As you can se the theme-check plugin has apache:apache instead of myuser:g_w_zorg.outsideit.net
I'm looking for a way so new files and folders created always get myuser:g_w_zorg.outsideit.net as user and group.
I played around with the s bit, but it seems this only works for files, not for folder or subfolders.
So I had a look at setfacl and tried:
sudo setfacl -Rdm u:myuser:rwx /var/www/zorg.outsideit.net/public_html/wp-content/plugins sudo setfacl -Rm u:myuser:rwx /var/www/zorg.outsideit.net/public_html/wp-content/plugins
But newly uploaded plugins still don't inherit the myuser:g_w_zorg.outsideit.net user and owner.
Any advice to achieve true inheritance of owner, group and permissions for files, folders and subfolders is appreciated.