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
<br />A year ago, there were no articles abo...
mysql query data from one table and insert it int...
This is an official screenshot. After MySQL 5.7 i...
Table of contents 1. Shared and Exclusive Locks 2...
Table of contents JSX environment construction In...
This article records the installation tutorial of...
1. Download MySQL Community Server 5.7.16 and ins...
Background Recently, I encountered such a problem...
Table of contents 1. Introduction 2. Usage Statel...
Table of contents docker system df docker system ...
Table of contents Step 1: Build the framework Ste...
Recently, I used vuethink in my project, which in...
JavaScript now releases a new version every year,...
Table of contents Vue routing relative path jump ...
Table of contents 1 Introduction to the new opera...