Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Setting of read and write permissions for Apache website directory under CVM Linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The setting of website directory file permissions is very important to the security of the website. The following Xiao Yun briefly introduces the basic settings of website directory file permissions.

We assume that the users and user groups running by the http server are www-data, the site user is www-data, and the site root is / var/www/html

Methods / steps

1 We first set the owner and all groups of website directories and files to www-data,www-data, as follows:

Sudo chown-R www-data:www-data / var/www/html

2 setting the website directory permission to 750750 means that www-data users have read and write permissions to the directory, so that www-data users can create files in any directory, and user groups have read execution permission, so that they can enter the directory, and other users do not have any permissions.

Sudo find-type d-exec chmod 750 {}\

3 setting the website file permission to 640640 means that only the www-data user has the permission to change the website file, the http server only has the permission to read the file, cannot change the file, and other users do not have any permission.

Sudo find-not-type d-exec chmod

4 set writeable permissions for individual directories. For example, some cached directories of the website need to have write permission to the http service. For example, the / data/ directory of discuz x2 must have write permissions.

Sudo find data-type d-exec chmod 770 {}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report