How to Reset Magento File Permission?

How to Reset Magento File Permission

Are you looking to reset Magento file permissions?

Magento file permissions define who can read, write and execute the files that make up the Magento store. 

Sometimes, you may get the error message while working due to wrong and improper file permissions. But no worries.

In this quick tutorial, we will learn how to reset Magento file permissions.

Magento 2 file permissions

The new files and folders we create in Magento come with default permissions. However, the default permissions are a security concern and could be harmful to files and folders containing sensitive data. 

For example: A folder has 777 permissions – which means anyone can read, write and execute the folder. It is not wise to keep the folder open like that.

You can view the files and folder permission by running the ls-li commands in the command line terminal.

How to Reset Magento File Permission

As you can see in the image, the permission of all the files and folders in the given directory is shown. We can see the permission flags, owner name, group name, last modification date, and time.

The second column is the Permission Flag Column. The drwxr-xr-x tells what permission the file in the particular directory has.

Let’s dissect:

  • d – directory
  • r – read
  • w – write
  • x – execute 

So:

  • drwxr-xr-x : directory-read-write-execute-read-execute-read-execute
  • Read Write and Execute for Admin
  • Read and Execute for Group
  • Read and Execute for Other

Now you know the permission flag, let’s reset the file permissions.

Magento 2 Reset Magento File Permissions

If you encounter an error executing, writing, or reading the file – you will find the errors as permission denied, no write permission, etc.

In that case, you have to reset Magento file permission.

Reset Permissions for Magento 2 by running the below commands in the terminal after navigating to the Magento root directory:

 find . -type f -exec chmod 644 {} \;
 find . -type d -exec chmod 755 {} \;
 chmod 550 mage 

Magento 2 File Permissions Command

In Magento, typically, all files should have 660 permissions. 660 permission means that the owner and the group can read and write, but other users have no permissions.

And admin can read, write and execute.

If permission 660 cannot be used, then you should use 644 instead.

Execute the following command to apply new permission for files:

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

Magento 2 Folder Permissions Command

In Magento, typically, all directories should have 770 permissions. The 770 permission means to read, write and execute permission to the owner and his group, but no permissions to anyone else.

Use 775 if 770 permission cannot be used.

Run the below command to apply new permissions for folders :

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

Reset Magento File Permission from Breeze

Follow the steps to reset files and folders permission to default.

  1. Login to your Breeze Platform
  2. Select the company you like to work on
  3. Click on ‘Sites’ to open the site list
  4. Open the ‘Store’ you want to work on
  5. Go to the Tool section from the options at Left
  6. Find the Reset Permissions and Reset them
How to Reset Magento File Permission

Wrap Up

Correcting permissions for your files and folders is a step in the right direction in securing your Magento store. Now, hackers won’t be able to exploit your Magento files.

If you encounter any issue, you can quickly reset the permission.

Got doubts and questions? Please leave them in the comment box.

Latest Magento Tips, Guides, & News

Stay updated with new stuff in the Magento ecosystem including exclusive deals, how-to articles, new plugins, and more. 100% Magento Goodness, a promise!

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

🎉 CYBER MONDAY SAVINGS 🎉

75% OFF on
ALL PLANS

Receive the coupon as soon as you
submit the email address. 🚀