I'm facing issues on inheriting the parent permissions for the folders created by PHP script which is executed by the server.
I've created the deployer user, added to www-data
group and set the initial folder and file config like below.
usermod -a -G www-data deployer
chown -R www-data:www-data /var/www
chmod -R 0775 /var/www
find /var/www -type d -exec chmod 2775 {} +;
find /var/www -type f -exec chmod 0664 {} +;
Edited the php5-fpm.conf
file like below with adding umask 0002
.
umask 0002
pre-start exec /usr/lib/php5/php5-fpm-checkconf
respawn
exec /usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.co
And this is the related part of my /etc/php5/fpm/pool.d/www.conf
, nginx user is also www-data
.
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
I've executed the setfacl command as below:
setfacl -Rm u:www-data:rwx,u:deployer:rwx,g:www-data:rwx /var/www/site/storage
setfacl -Rdm u:www-data:rwx,u:deployer:rwx,g:www-data:rwx /var/www/site/storage
However, when a PHP script, executed by the server, tries to create a folder within the storage folder which was created by the deployer user, newly created folders don't inherit the parent permissions.
drwxrwsr-x+ deployer www-data storage
drwxr-sr-x+ www-data www-data storage-cache-folder
drwxr-sr-x+ www-data www-data storage-cache-folder-subfolder
What am I missing?