The relationship between Linux permissions and Umask

Source: Internet
Author: User
Tags readable file permissions

Linux file permissions are primarily defined for three types of objects
Owner: Master, u
Group: Genus, G
Other: Others, O
Each file has three permissions defined for each type of visitor
R:readable
W:writable
X:excutable
rw-r--r--
Top three: Indicates the permissions that the user has
Medium Three-bit: Represents the permissions of the group in which the user resides
The latter three: represents the permissions of other users

Permissions Binary Octal
--- 000 0
--x 001 1
-w- 010 2
-wx 011 3
r-- 100 4
R-x 101 5
rw- 110 6
Rwx 111 7



R: Readable w: writable x: Executable

Umask (reverse mask also called Mask code)
The Umask value can be used to retain the Create file permission

New file Permission: 666-umask If the result has an execute (odd) permission on a bit, its permissions +1

(Example: The file is created by default is not execute permissions, so the maximum permission is 666, if umask=023,666-023=643, this is actually a problem.) Because this allows other users to have execute permissions, which is not allowed by default, it is necessary to carry plus 1, the correct result is 666-023=644, that is, for the file if the result of the reduction contains the execution permissions, you need to add 1 processing. )
New DIR Permission: 777-umask


Default Umask value

Non-privileged user umask is 002
Root Umask is 022.

#umask可以查看当前umask
Four-bit leftmost without tube when viewing umask (is the extended bit sst:suid, SGID, sticky{000-111})

The mask code can be set by itself, using the command:
#umask number
Umask temporary modification is only valid for the current shell

To change changes permanently

Global Settings:/ETC/BASHRC

User settings: ~/.BASHRC


The relationship between Linux permissions and Umask

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.