umask 显示或设置权限掩码
Syntax format: umask "option" "Mode" umask [options] [mode]
Note: The Umask command, followed by options and patterns, must have at least one space between each element
Parameter options:
parameter Options |
Explanatory notes |
-P |
The output permission mask can be executed directly as a command. |
-S |
Output a permission mask in character mode |
Case one:
How permission masks are computed
Directory permission calculation |
The directory permission calculation has no odd even points |
(7 7 7)-(0 2 2) = 7 5 5 |
File permission calculation |
1. Permission mask 022 (even digits) |
(6 6 6)-(0 2 2) = 6 4 4 |
2. Permission Mask 045 (with odd digits, result in odd digits + 1) |
(6 6 6)-(0 4 5) = (6 2 1) + (0 0 1) = 6 2 2 |
Case TWO:
To view the system default Umask value
Note: The umask default values for Superuser and normal users are different and are defined by the/etc/profile configuration file.
Case THREE:
Example of parameter-p-s
Case FOUR:
Example of temporarily modifying Umask values
Impact on a file
Impact on the Directory
Note: The above is temporary and permanent, you can modify the/ETC/BASHRC or/etc/profile configuration file. here generally do not need to modify, the default permissions are the critical point of security permissions, work as far as possible to the critical point, or less than the critical point, not greater than the threshold permissions
Linux Common Commands--umask