Linux Common Commands--umask

Source: Internet
Author: User

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

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.