Linux Bulk Set folder 755 file 644 Permissions

Source: Internet
Author: User
Tags chmod file permissions

Website move especially from the virtual space or Windows to the Linux VPS will appear file permissions issues, usually directories are 755 permissions, file is 644 permissions. One change is more troublesome, you can use the command simple and quick modification.

First the CD to the site directory you want to modify, and then run the following two commands to quickly batch modify permissions.

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

In addition, often modified with sftp to upload a new file is the root group, can be modified to the WWW user group, the following command:
Chown-r www:www/home/wwwroot/Web 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

Always use the command to record.

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 methods:

chmod 644-r./
Find./-type D-print|xargs chmod 755;

Methods 1 and 2 are found on the Internet, and when the test is discovered, setting 644 is a bit problematic. So, the recommended method inside, I first use chmod all set 644, and then use Find to set the directory section to 755. Note that the./is for the site code in the directory set up Oh.

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.