In Magento 2 permission is very important. Some features ( or whole website ) won’t work properly if you don’t set the permission correctly. So what are the correct file and folder permissions for Magento 2 and How to set Magento 2 file/folder permissions? Let’s find out
Magento recommend setting the permissions of file/folder in Magento 2 as below:
- 755 for directories: User has a full control and Group/World can traverse directories;
- 644 for files: User – read, write; Group/ World – read.
It’s clear but how to set the permission like that? We can set them using following commands ( via SSH )
1 2 3 |
cd YOUR_MAGENTO2_ROOT_DIRECTORY find . -type f -exec chmod 644 {} \; // set 644 permission for files find . -type d -exec chmod 755 {} \; // set 755 permission for directory |
You may need to clear Magento cache then, using command
1 |
php bin/magento cache:clean |
That’s all we need to do to set correct permission for files and directories in Magento 2
If you have any question, just leave us a message.