Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux's method of viewing user groups

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to view user groups on linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Linux can view user groups using the following command:

Groups to view the group members of the currently logged in user

Groups gliethttp views the group in which the gliethttp user belongs and the members of the group

Whoami to view the current login user name

User (user) and user group (group) concepts:

1. The concept of user

Through the previous understanding of Linux multi-user, we understand that Linux is a real multi-user operating system, so we can build several users (user) in Linux system. For example, our colleague wants to use my computer, but I don't want him to log in with my user name, because there are materials and information under my user name that I don't want others to see (that is, private content). Then I can create a new user name for him and let him use my user name to deal with it, which is in line with the operating rules from the point of view of computer security.

Of course, the concept of user is not limited to that. There are also some users in the Linux system who are used to accomplish specific tasks, such as nobody and ftp. When we visit the web program of LinuxSir.Org, we are nobody users; when we visit ftp anonymously, we use the user ftp or nobody; if you want to know some accounts of the Linux system, please check / etc/passwd

2. The concept of user group (group)

A group is a collection of users with the same characteristics (user) For example, sometimes we want multiple users to have the same permissions, such as viewing or modifying a file or executing a command, then we need a user group, and we define all users to the same user group. By modifying the permissions of the file or directory, let the user group have certain operation rights, so that the users under the user group have the same permissions on the file or directory. This is achieved by defining groups and modifying file permissions.

For example: in order to give some users the right to view a certain document, such as a schedule, and the person who wrote the schedule should have read and write permission, we want some users to know the contents of the schedule and not let them modify it. So we can put these users into a group, and then modify the permissions of the file to make the user group readable. So that every user under the user group is readable

The corresponding relationship between users and user groups is one-to-one, many-to-one, one-to-many or many-to-many.

One-to-one: a user can be the only member of a group

Many-to-one: multiple users can be members of a unique group and do not belong to other user groups; for example, beinan and linuxsir only belong to the beinan user group

One-to-many: a user can be a member of multiple user groups; for example, beinan can be a member of a root group, a linuxsir user group, or an adm user group

Many-to-many: multiple users correspond to multiple user groups, and several users can belong to the same group; in fact, the many-to-many relationship is an extension of the first three; after understanding the above three, this one can also be understood

Tools or commands for managing user groups (group):

Groupadd note: add user group; groupdel note: delete user group; groupmod note: modify user group information groups note: display the user group to which the user belongs grpck grpconv note: synchronize or create / etc/gshadow through the file contents of / etc/group and / etc/gshadow, or create if / etc/gshadow does not exist; grpunconv note: synchronize or create / etc/group through / etc/group and / etc/gshadow file contents, and then delete the gshadow file This is the end of the method of viewing user groups on linux. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report