Magento 2How To GuideMay 30, 2024Simon Walker

[Fixed] Magento 2: You Don't Have Permission to Access / on this Server

[Fixed] Magento 2: You Don't Have Permission to Access / on this Server

There is no doubt that Magento is one of the most powerful eCommerce platforms. It is considered as the top 3 eCommerce platforms, along with Shopify and WooCommerce. However, no platform is without its fair share of problems and Magento is no exception. When working with Magento 2, you may get an error with the following message:

Forbidden You don’t have permission to access / on this server
Or
Sorry you need permissions to view this content Magento 2

This error can be extremely frustrating even for the most experienced Magento users. However, don’t worry as in this tutorial, I’ll show you the main reason behind this error and a proven & tested method to fix it. Once you are done with this tutorial, you no longer need to worry about “You don’t have permission to access / on this server” or “Magento 2 sorry you need permissions to view this content” error.

Why Does This Error Appear?

This error occurs when there is a problem with the permission settings in your Magento 2 file system. In other words, you may not have the necessary permissions on your web server.

Reasons for Magento 2 “You Don't Have Permission to Access / on this Server”

As said earlier, the error occurs when there is a permission settings error in the Magento 2 file system. Other than that, issues within the .htaccess file and Security-Enhanced Linux (SELinux) policies can result in the error too.

Solution

To fix this issue, understand the following two default server permissions used for Magento 2 files and folders.

  • 775 for directories. It gives full control for the user and the group.
  • 664 for files. It gives the write permission for the user and the group and read-only for everyone else.

Grant Permissions:

So, use the following command to grant permissions to the Magento 2 folder that will prevent the error “You don’t have permission to access / on this server”.

sudo chmod 755 /path/to/your/magento2

Conclusion

This concludes our article on how resolve the permission error in Magento 2. Refer to the official guidelines for more information related to permissions in Magento 2. If you still have any queries or require help with anything related to Magento, contact our team.

Related Posts: