We are working on local environments to do our developments and we don't want Magento 2 to change file permissions - actually, we think that Magento 2 should never change file permissions, it's not its responsibility to handle filesystem strategy.

How can we do that? Currently, Magento 2 keeps on updating file ownership and permissions.

  • where is magento changing you file permissions? Mar 2, 2020 at 10:13
  • Anytime we execute a command using bin/magento. For example, bin/magento setup:di:compile. Mar 2, 2020 at 10:45
  • You need to execute them with your webserver user Mar 2, 2020 at 10:55

1 Answer 1


Magento is using the user configured in your web server (Nginx, Apache) and when executing Magento command you should also use this user.

For local development systems, it's fine IMHO to use the logged-in user.

For non-local systems you want to use a dedicated user (www-data) which is also supposed to run the cronjobs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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