Welcome to our Magento 2 Permission Setting tutorial! In this post, we'll go over how to set the correct file and folder permissions for your Magento website to ensure that it runs securely and efficiently.
I. Permission setting basics: Each file and folder has specific permission settings in the system that are used to control access to those files and folders by different users. Permissions are usually represented by a three-digit number, with each digit representing the permission level for a different group of users (file owner, user group, other users). For example, the number 6 represents read-write permissions, while 7 represents read-write-execute permissions.
![图片[1]-Magento 2 权限设置指南:初学者友好教程-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/01/2024010503551815-1024x585.png)
II. Document permission settings:
- Open a terminal or command prompt.
- utilization
cdcommand navigates to the Magento installation directory. - Enter the following command to set the permissions of all files to 644 (the owner of the file can read and write, others can only read):
find . -type f -exec chmod 644 '{}' \;.
Third, folder permission settings:
- In the same terminal, enter the following command to set the permissions of all folders to 755 (the owner of the file can read, write, and execute; others can only read and execute):
find . -type d -exec chmod 755 '{}' \;.
IV. Special directory permission settings:
- Magento requires files to be written in certain directories such as
var,pub/mediarespond in singingpub/staticThe - To set 777 permissions (read-write execution for all users) for these directories, use the following command:
find . /var -type d -exec chmod 777 {} \;.
find . /pub/static -type d -exec chmod 777 '{}' \;
find . /pub/media -type d -exec chmod 777 '{}' \; find .
![图片[2]-Magento 2 权限设置指南:初学者友好教程-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/01/2024010503583679-1024x585.png)
Attention:
- Be especially careful when using 777 permissions, as it allows all users to perform any operation on a file or folder and may be a security risk.
- Before running these commands, make sure you have sufficient privileges (root or administrator privileges may be required).
With the above steps, you can set appropriate file and folder permissions for your Magento website to enhance security and stability. If you encounter difficulties in performing these steps, it is recommended to consult a professional IT expert or the Magento community for help.
![图片[3]-Magento 2 权限设置指南:初学者友好教程-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/01/2024010503581456-1024x585.png)
Link to this article:https://www.361sale.com/en/5770/The article is copyrighted and must be reproduced with attribution.



















![表情[wozuimei]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![表情[baoquan]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

No comments