Preface The origin is a question 1: If your umask is set to 022, what are the default permissions for the files you create? This reminds me of another question I was asked 2: What permissions does 777 represent? User Group Description -rwxrw-r--1 root root 1213 Feb 2 09:39 abc
Digital Rights Description So back to question 2, 777 is a three-digit octal number, corresponding to 111111111, which means that all three groups are readable, writable, and executable. We can use it like this: chmod 755 abc //chmod changes the permissions of file abc to be readable, writable and executable by the file owner, and readable and executable by users in the same group and other groups umask Description umask is a permission mask, which represents the default permissions. It is used to calculate the default permissions for new objects created by the user based on the maximum default values of 666 for files and 777 for folders. For example, in question 1, the default permissions for creating a file are 666-022=644, which is -rw-r--r-- What is umask used for? The default umask value is 022 (you can use the umask command to view it). At this time, the default permissions of the files you create are 644 (6-0, 6-2, 6-2), and the default permissions of the directories you create are 755 (7-0, 7-2, 7-2). You can verify it with ls -l. Now you should know the purpose of umask, which is to control the default permissions. [root@bogon test]# id uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 [root@bogon test]# umask [root@bogon test]# touch a.txt [root@bogon test]# ls -l total 0 -rw-r--r--. 1 root root 0 Jul 3 00:40 a.txt [root@bogon test]# mkdir b [root@bogon test]# ls -l total 0 -rw-r--r--. 1 root root 0 Jul 3 00:40 a.txt drwxr-xr-x. 2 root root 6 Jul 3 00:41 b As can be seen above, the umask of root is 022 (the first 0 represents the special permission bit, which is not considered here), the default permissions of created files are 644, and the default permissions of created directories are 755. Before understanding the use of umask, you need to explain the basic permissions of the file.
Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
>>: How to use resident nodes for layer management in CocosCreator
Usage of alter command in mysql to edit table str...
Purchase Certificate You can purchase it from Ali...
Table of contents 1. Number in JavaScript 2. Math...
Sprite Cow download CSS Lint download Prefixr dow...
Communication between containers 1. Network shari...
Table of contents What is an agent Basic knowledg...
I have just started using react to do projects, a...
Problems that may arise from optimization Optimiz...
What is ZooKeeper ZooKeeper is a top-level projec...
My first server program I'm currently learnin...
Table of contents Install Dependencies Install bo...
1. Operating Environment vmware14pro Ubuntu 16.04...
Recently, Microsoft released the 2019 server syst...
1. Construction components 1. A form must contain...
To see the effect directly, a right-click menu ha...