In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
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: what does 2: 777 mean?
User group description
-rwxrw-r--1 root root 1213 Feb 2 09:39 abc the first character represents the file (-), the directory (d), and the link (l) the remaining characters in groups of three (rwx) Read (r), write (w), execute (x) the first set of rwx: the permission of the file owner is to read, write and execute the second group of rw-:, but the permission of the users of the same group as the file owner is to read, write but cannot execute the third group of rw-:: the permissions of other users who are not in the same group as the file owner are read, unable to write and execute, which can also be expressed as: rsque4, rwx, wimp2, and xqq1, because the file represents three binary words. Just in time to calculate these figures.
Digital permission description
So going back to the previous question, 2777 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 change the permissions of the file abc to be readable, writable and executable for the file owner, and readable and executable for the same group and other groups of users
Umask description
Umask is the permission mask, which represents the permissions that the user does not want by default. It calculates the default permissions of the user's new object based on the file's maximum default value of 666 and folder 777.
For example, question 1, then the default permission to create a file is 666-022 permission 644, that is,-rw-r--r--
What is umask used for?
By default, the umask value is 022 (you can view it with the umask command). At this time, the default permission for the file you establish is 644 (6-0meme 6-2meme 6-2), and the default permission for the directory is 755 (7-0meme7-2recover7-2). You can use ls-l to verify it, and now you should know the use of umask, it is to control the default permissions.
[root@bogon test] # iduid=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-ltotal 1 root root 0 Jul 3 00:40 a.txt [root@bogon test] # mkdir b [root@bogon test] # ls-ltotal 0Murray Rukyu. 1 root root 0 Jul 3 00:40 a.txtdrwxr-xr-x. 2 root root 6 Jul 3 00:41 b
As you can see from the above, the umask of root is 022 (the first 0 represents the special permission bit, which is not considered here), the default permission for the created file is 644, and the created directory is 755.
Before you know how to use umask, you need to explain the basic permissions of the file below.
Linux file permissions rwx files can be viewed, files can be modified, files can be launched into a running program directory, ls can view the file names in the directory, files can be created or deleted in the directory (only w permissions cannot be created, x cooperation is required) you can use cd to enter this directory ls-l to display the metadata information of the files in the directory
Summary
The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.