Linux default preset permission properties Umask (brother Bird's Linux Private Kitchen Basic Learning Chapter Third Edition-seventh) | (To be perfected) __linux

Source: Internet
Author: User
The system defaults to the default permissions properties of the query directly umask, you can get the following content (this will be related to the role of the currently logged-on user):
0022
How is 4 group Ah, should not be 3 groups. In fact, "The general permissions are related to the next 3 groups, the first group of special permissions used, followed by the supplementary"With the "-S" parameter, you can get the information that displays the permissions in symbol type, as follows:
U=rwx,g=rx,o=rx
The directory is not the same as the file on the properties of the default permissions. We know that X permissions are very important for the directory! However, the general file should not have the right to execute, because the general file is usually used for data records! Of course, there is no need to execute the permissions. Therefore, the preset 冴 is as follows: If the user established as "file" preset "no executable (x) permission", that is, only RW two items, that is, the maximum is 666 points, preset permissions are as follows:
-rw-rw-rw-
If the user is established as "directory," because X is related to whether or not this directory is accessible, the default is all permissions are open, that is, 777 points, preset permissions are as follows:
Drwxrwxrwx
Note that the Umask score refers to the "top default value that needs to be lost!" Because R, W, X is 4, 2, 1, so, Hello! In other words, when you want to take off the right to write, you can enter 2 points, and if you want to take fall can read the permission, that is, 4 points, then to take off the read and write permission, that is, 6 points, and to take away the execution and write permission, that is, 3 points, so understand? So 5 points is What, huh? is the right to read and execute! If the above example illustrates, because the umask is 0022, so the user has not been taken off any permissions, but the group and others permissions are removed 2 (that is, w this permission), then when the user: Create a file: (-rw-rw-rw-)-(-- ---w--w-) ==>-rw-r--r--when creating a directory: (DRWXRWXRWX)-(d----w--w-) ==> drwxr-xr-x So how to modify the Umask value, very simple, directly in the Umask Then add the value you want to modify, such as:
Umask 002
So again input umask see is 0002, that is, the umask behind the number can not consider the first set of numbers, but you think it is not wrong ah, for example: direct umask 0002 and then umask see or 0002, it will not go wrong, you try it on the preset In the case, the root of the umask will take away more properties, root umask default is 0022, this is based on security considerations ~ As for general identity users, usually their umask is 0002, that is, retain the same group write power! In fact, the setting of the preset umask can refer to the contents of/ETC/BASHRC This file, however, it is not recommended to modify the file in short umask is a very important dongdong, must understand it; especially if you have a team work in the directory or file you are building, be sure to get permission.

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.