Linux how to do file and directory permissions

Source: Internet
Author: User
Tags chmod readable

The chmod command can change permissions for all subdirectories:

To change the permissions of a file:

The code is as follows Copy Code

chmod mode File|dir

To change permissions for all subdirectories:

The code is as follows Copy Code
chmod mode Dir-r

Note that the-R parameter is appended

For example, change all files under File directory to 777:

The code is as follows Copy Code

chmod 777 File-r

Digital Setting method

We must first understand the meaning of a number-represented attribute: 0 means no permission, 1 for executable, 2 for writable, 4 for readable, and then adds. Therefore, the format of the numeric attribute should be 3 octal from 0 to 7, in the Order of (U) (g) (O).

For example, if you want the owner of a file to have read/write two permissions, you need to have 4 (readable) +2 (writable) =6 (read/write).

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.