Skip to content

setup:di:compile's generated cache files inaccessible by the web-server user #11930

Closed
@JanisE

Description

@JanisE

Preconditions

  1. OS: Linux Mint 18.2 (based on Ubuntu Xenial).
  2. Magento CE 2.2.0 with sample data is installed by Composer.
  3. Permissions and ownership set up as instructed on http://devdocs.magento.com/guides/v2.1/install-gde/prereq/file-system-perms.html#perms-private for two-user system (users "magento_user" and "www-data").

Steps to reproduce

  1. Run bin/magento setup:di:compile as Magento file system owner ("magento_user").
  2. Open the web site.

Expected result

  1. Web site opens.

Actual result

  1. var/cache/* folders lose their set-gid bits.
  2. var/cache/mage-tags/* folders are created with "magento_user"'s primary group and 660 permissions.
  3. The web user ("www-data") fails opening the site because it cannot access this content:
1 exception(s):
Exception #0 (Exception): Warning: file_put_contents(/var/www/m2training/public/var/cache//mage-tags/mage---762_COMPILED_CONFIG): failed to open stream: Permission denied in /var/www/m2training/public/vendor/colinmollenhour/cache-backend-file/File.php on line 663

The problem was reported also in this StackExchange question: https://magento.stackexchange.com/q/193727/60128

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions