0

This is happening for the first time after months of developing. I don't know what changed.

We set file permissions and then We run in Magento2 root folder:

sudo chown -R user:apache .

But, every time We run commands like.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
composer install
composer update

and every time some of the users in apache group modifies any file We get that file changes to user:user group. So, nobody else in apache group can access files (neither apache itself, so naturally website breaks).

How can I set to keep :apache as group owner?

EDIT:

So, I followed this instructions and was able to get modified files to keep the apache group ownership: https://serverfault.com/questions/46886/linux-losing-group-ownership-of-files but still the new uploaded files by different users are owned by user:user instead of user:apache. How could I solve this?

0

So, basically had to follow this instructions: https://serverfault.com/questions/46886/linux-losing-group-ownership-of-files

Which lead me to run following commands:

chgrp apache /var/www/html/magento2
chmod g+ws /var/www/html/magento2

And following command to set all folders to inherit the same previous command:

find /var/www/html/magento2 -type d -print0 | xargs -r0 chmod g+ws

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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