How to Set Magento 2 File and Folder Permissions?
- Nidhi Arora
- 8 years
If you are new to Magento or don’t know what to do with the Magento 2 file and folder permission, you have come to the right place. Unluckily, Magento 2 is a bit complicated and you need the assistance of a certified Magento developer to manage certain things in your online store.
Being an expert eCommerce development agency, we will let you know how you can set Magento 2 file and folder permission to use them properly. So, let’s get started.
Magento 2 Folder/File Permissions
The owner of the Magento file system should be able to read/write/execute all files and folders and the webserver user must have write access to the var app/etc pub. Also, do not forget that the web server’s group must own the file system.
We recommend setting the permissions as follows:
>> All directories have 770 permissions.
770 permissions give full control (that is, read/write/execute) to the owner and to the group and no permissions to anyone else.
>> All files have 660 permissions.
660 permissions mean the owner and the group can read and write but other users have no permissions.
You should set as below recommended.
find . -type f -exec chmod 644 {} \; // 644 permission for files
find . -type d -exec chmod 755 {} \; // 755 permission for directory
find ./var -type d -exec chmod 777 {} \; // 777 permission for var folder
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
If you still have any queries regarding this “How to” or would like to add some suggestions to this solution, let us know your feedback or query at sales@envisionecommerce.com, and don’t forget to share this “How to” blog with your fellow Magento 2 users!
Download Blog