MagentoMagento 2

Setting the Correct File and Folders Permissions for Magento 2

Based on the Magento 2 Developer Documentation the following are the requirements for File & Folder permissions

  • 775 for directories, which means full control by the user, full control by the group, and enables everyone to traverse the directory. These permissions are typically required by shared hosting providers.
  • 664 for files, which means writable by the user, writable by the group, and read-only for everyone else.

To set the proper file and folder permissions log into your website hosting via SSH and run the following commands:

1) Navigate to your store root

cd <your Magento 2 root dir>

2) Set the proper permissions for all files

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

3) Set proper permissions for all folders

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

4) Set proper permissions for the var, static and media folders

find var pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var pub/static pub/media app/etc -type d -exec chmod g+ws {} \;

5) The last step is to ensure that after your changes that the installation is still executable for the current user

chmod u+x bin/magento

 

Advertisement

Hans-Eirik Hanifl

Hans-Eirik Hanifl is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

Related Articles

Leave a Reply

Advertisement
Back to top button
Sign up to the E-Commerce Gorilla newsletter for updates & special promotions.
Join Our Newsletter
SUBSCRIBE
We value your privacy and protect your information like our own. Unsubscribe at anytime.