A detailed explanation of Linux umask functions

Source: Internet
Author: User
Tags execution

The Umask function in Linux is used primarily to mask access permission that is not appropriate for new files or directories when creating new files or directories.

There are 9 kinds of access permission for files, respectively: rwxrwxrwx

They represent: User Read user Write user Execute Group read Group write group perform other read other write other execution

The rules for shielding are as follows:

1. No matter how much the shielding code is,

• The newly created file does not have permission to execute by default.

• The newly created directory has executable permission by default.

2. The format of the screen code is octal format, a total of three octal number. You can set the following 002 or 022 or ...

3. Each of these octal is represented by three digits, namely, read-write execution

4 2 1

For example, 002 is represented in binary as: 0 0 0--0 0 0--0 1 0

4 2 1 4 2 1 4 2 1

4. The resulting file is the umask value of the allowable permission, namely

For file: ~002 = 664 (the access rights that the newly created file should have)

For directory: ~002 = 775 (The access rights that the newly created directory should have)

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.