cancel
Showing results for 
Search instead for 
Did you mean: 

File/Folder Ownership not being Respected

File/Folder Ownership not being Respected

Magento 2.0.2
PHP 7.0.3
nginx/1.9.3 (Ubuntu)

- Our set-up is installed in a user directory.
- The user is a member of only it's own group (uldev) and the www-data group.
- We run the CLI commands as user uldev
- The web process is also in the www-data group.

We have noticed two issues.

1. Command-line (CLI) actions:
- All works as expected - except that we have noticed that when running commands many directories and files ownership is set to uldev:uldev, instead of uldev:www-data as expected. IE they are not properly inheriting there ownerships.
- Examples which caused this behavior:
magento setup:static-content:deploy
magento deploy:mode:set production

After noticing the issue, we simply ran chown -R uldev:www-data . to correct the ownerships. Good fix if the issue does not come back. But it did.

2. We noticed an inverse of the problem when switching back to development mode (via CLI with no noticeable issues) and then refreshing the home page, the group write permissions in some cases were removed from certain directories (ex. pub/static) and the ownership of some files were changed to www-data:www-data for certain files written (ex. pub/static/_requirejs).

Are we setting ourselves up for tears and agony by attempting to run as a non-privileged user.

Please explain! Thanks.

1 REPLY 1

Re: File/Folder Ownership not being Respected

I've also been battling with this exact same issue for several days and haven't had any luck with any of the resources I've found for permissions/ownership. I've now got the system creating the files/directories using the same ownership permissions as the other files (user:www-data) but now we recieve one of two errors when we attempt running the commands.

 

Element 'type': Character content other than whitespace is not allowed because the content type is 'element-only'.
Line: 6

or

There are no commands defined in the "setup" namespace.

The second error is normally displayed if you attempt to run a setup command a second time after recieving the type error above. Removing the var/generation folder and re-running the command will usually display the first error.