How To Set Magento 2.x Directory and Files Permission

There are following below command need to run on the root of Magento 2 to set correct directory and files permission

[1] Set all directory permission to 775

find . -type d -exec chmod 775 {} \;

[2] Set all files permission to 664

find . -type f -exec chmod 664 {} \;

[3] Set 777 Specific Directory & Files Permission

sudo chmod 777 app/etc
sudo chmod 644 app/etc/*.xml
find var -type d -exec chmod 777 {} \;
find pub/media -type d -exec chmod 777 {} \;
find pub/static -type d -exec chmod 777 {} \;
sudo chmod -R 777 generated
sudo chmod u+x bin/magento

Leave a Reply

Your email address will not be published. Required fields are marked *