How to set Magento 2 permissions and avoid installation errors

From Brian Nelson Ramblings
Jump to: navigation, search

How to set Magento 2 permissions and avoid installation errors

If you encounter installation problems or other read/write limitations, try setting the permissions below in your Magento 2 installation.

Set Magento Permissions:

cd <your Magento install dir> 
find . -type f -exec chmod 664 {} \;                        
find . -type d -exec chmod 775 {} \;                       
find ./var -type d -exec chmod 777 {} \;                 
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chown -R :<web server group> .
chmod u+x bin/magento

Note1: Depending on how the server is configured, when copying files via FTP, copied files may have wrong permissions, or wrong group. In this case, run above permission setup again after copying the new files.

Note 2: Make sure the user you are logged with have all necessary permissions and is assigned to the same group as magento. A common problem is that magento files have a different group than the files you just copied or installed, leading to various installation problems