Linux Bulk Modify folder 755 file 644 Permissions

Source: Internet
Author: User


This article for you to introduce a Linux batch setup folder 755 Web page File 644 Permissions example, I hope this tutorial can help you.


Web site relocation, especially from virtual space or Windows to the Linux VPS will appear file permissions problems, usually the directory is 755 permissions, the file is 644 permissions.

first, CD to the site directory you want to modify, and then run the following two commands to quickly bulk Modify permissions.

find-type D|xargs chmod 755
find-type F|xargs chmod 644

In addition, often using SFTP to modify the upload of new files is the root user group, can be modified to the WWW user group, the command is as follows:


chown-r www:www/home/wwwroot/Site Directory

Here's another way to add

Method 1

find.-exec sh-c "If [[-D" {} "]]; Then chmod 755 "{}"; else chmod 644 "{}"; Fi "\;

Method 2

find./-type f-print |xargs chmod 644;
find./-type d-print|xargs chmod 755;


Method 3

frequently used commands, record them.

Find/path-type f-exec chmod 644 {} \; Set file permissions to 644

find/path-type d-exec chmod 755 {} \; Set directory permissions to 755

Recommended Method:

chmod 644-r./
find./-type d-print|xargs chmod 755;

Method 1 and Method 2 are found online, when the test found that the setting of 644 is a bit of a problem.

So, the recommended method inside, I first use chmod all set 644, then use Find to set the directory portion to 755.

Note./Is the directory settings that are located in the site code.


Linux Bulk Modify folder 755 file 644 Permissions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.