What is the file permissions of Magento 2.0?

Elizabeth Bosy Elizabeth Bosy asked June 1, 2016

What is the file permissions of Magento 2.0? Is there any additional thing to notice while installing Magento 2.0 from the web interface?

1 answer

Jai Jai Staff June 1, 2016

‘Admin’ user is the owner of all Magento 2.0 files on our server, and Apache web server runs on behalf of ‘www-data’ user. Magento 2.0 documentation describes the access permission settings for files and directories on the principle that the web server runs on behalf of the user which is the owner of all Magento 2.0 files. Our opinion is: it’s not the best decision, as it can lead to security issues (as the web server has permissions to write and run the code) as well as issues with setting access permissions for third party developers (as you’re not logging in as www-data user). We normally use the following access permissions:

chown -R admin:www-data /var/www/magento2
find /var/www/magento2 -type f -print0 | xargs -r0 chmod 640
find /var/www/magento2 -type d -print0 | xargs -r0 chmod 750
chmod -R g+w /var/www/magento2/{pub,var}

If you’re going to install Magento 2.0 from the web interface, then add write permissions for app/etc/ and vendor/:

chmod -R g+w /var/www/magento2/{app/etc,vendor}

 

#1

Please login or Register to Submit Answer