Magento 2 files and folder permissions

Hi Guys, Just a quick article to set up correct Magento 2 folder & files permission settings. All the files to be set with 644 and folders to be set with 775 – Source

You need to have root access or sudo access to run the following commands -:

Login to the box and go to the path where magento is installed and run the following commands -:

find . -type d -exec chmod 755 '{}' ; find . -type f -exec chmod 644 '{}' ; 

The above commands will make sure that all the top level permission has been set properly.

Next you need to make sure var, pubmedia, pubstatic directories has write permission because most of the files will be written in these two folders. So now to give them write permission then use the following commands -:

find .var -type d -exec chmod 777 {} ; find .pubstatic -type d -exec chmod 777 '{}' ; find .pubmedia -type d -exec chmod 777 '{}' ; 

The above would be enough to make Magento 2 up and running with all the correct permissions. You might need to run the following commands if you still have permission issues -:

chmod 777 .appetc chmod 644 .appetc*.xml 

The above will sort out all the permission problems with Magento 2 installation. If you are using Magento 1 then follow this link to set correct files and folder permission on Magento 1. Hope this article helped you in some way. Please leave us your comment and let us know what do you think? Thanks.

Similar Posts