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