I am running apache as www-data in group www-data I create a magento file system user: magento and assigned it to a new group - web I then also added www-data user to web. Assigned permissions per Magento docs:

   cd /var/www/html/magento2 && find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && chown -R :web . && chmod u+x bin/magento


find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \; && chmod u+x bin/magento

This did not work. However, when I actually assigned magento user to www-data group and ran the two commands above, it works.

My question is if there a logic behind this behavior? Or I might have just made an error while try things out with the web group?



When you create the magento user, it also creates a group called magento as magento user's default group. You can name the magento user anything you like, however, Magento requires the "magento user" to belong to the Apache user group, which on Ubuntu is always www-data. For clarity, the apache user should also belong to Magento's default group.

Easiest way to accomplish above is:

  1. adduser magento
  2. usermod -aG www-data,sudo magento
  3. usermod -aG magento www-data

For simplicity's sake naming the magento user "magento" is convenient, but not required.

A long way of saying that if you create an alternate group like "Web" and use that instead of www-data you'll run into problems

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.