In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "detailed explanation of users and groups and file permissions in Linux". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the detailed explanation of users and groups and file permissions in Linux".
Catalogue
0x01 users and groups
0x02 file permissions
0x01 users and groups
Linux must have a user, even a virtual user, which will be discussed later, and the user also has a unique identity UID (User Identify) in the system.
With users, there will be a user group, and the user group also has an identity GID (Group Identify) in the system.
There is a feature in Linux: as long as there is a user, the user must belong to a user group, and a user needs to belong to at least one user group. If there is no user group when the user is created, the system will make the user belong to the same user group as the user name by default, that is, UID is the same as GID by default.
Having said that, let's talk about the user categories in Linux, which will explain why it is said at the beginning that Linux must have users.
Users are divided into three categories in Linux
Administrator: UID must be 0, and anyone with a UID of 0 is a super user, which is equivalent to the power of life and death of the ancient emperors, who can delete the system itself.
Virtual users: UID range 1-499, the system exists by default or generated when installing software, although it exists but can not be used normally, such as nologin is not allowed to log in, it exists only to meet the needs of service operation, in Linux, the operation of services and programs must belong to users, so in order to meet such needs, there is still a need for such a user.
So how do we create a virtual user if we want to add it?
If the user name is not followed by the user name, the current user password is changed.
If you want to switch users, use the following command to switch
Su-
Here's the difference between su and su-two commands.
Su only switches the user identity, but the shell environment is still the shell; of the original user, while su-even the user and the shell environment switch together
Then let's talk about adding user groups.
User groups can exist first, there can be no users, but the existence of users must first have user groups, for example, a person must be born with parents, but having parents does not necessarily have you.
You can create a user group using the following command
Groupadd
Then you can create a user for the user group with the following command
Next, let's talk about the permissions of the file.
Then there are nine characters left, which are divided into three groups every three bits.
The first group represents the permissions of the user, that is, the permissions of the current file owner
The second group represents the permissions of the user group, that is, the permissions of the user group to which the current file belongs, that is, the permissions of the users belonging to this user group to the file.
The third group represents the permissions of other user groups, that is, the permissions of user groups other than the second group to this file.
That's what it looks like down there.
When you finish talking in groups, then talk about the meaning represented by the characters in each group. In the figure above, there are four rwx- characters that represent permissions.
R (read) readable permissions, corresponding to digital 4w (write) writable permissions, corresponding to digital 2x (execute) executable permissions, corresponding to numeral 1-no permissions, corresponding to numeral 0
In fact, in addition to these, there are some special permissions: t, T, s, S, x, X, +, not to mention these. If it is useful later, in fact, everyone should be familiar with the s authority, because the s authority can be used to raise rights.
Thank you for your reading, the above is the content of "detailed explanation of users and groups and file permissions in Linux". After the study of this article, I believe you have a deeper understanding of the detailed interpretation of users and groups and file permissions in Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.