View all users and all user groups under Linux

Source: Internet
Author: User
Tags file permissions

Roups viewing the members of the currently logged on user group
Groups Gliethttp View the group that the Gliethttp user is in, and the members in the group
WHOAMI View the currently logged in user name

/etc/group file contains all groups
All user names exist for/etc/shadow and/etc/passwd systems

1,/etc/group commentary;
The/etc/group file is a user group profile that includes users and user groups, and can show which user group or groups of users belong to, because one user can belong to one or more different groups of users, and users of the same user group have similar characteristics. For example, if we add a user to the root user group, then the user can browse the root user's home directory files, if the root user to open the read and write permissions of a file, all users of the root user group can modify the file, if it is executable files (such as scripts), The user of the root user group can also be executed;

User group's characteristics in system management for the system administrator to provide a great convenience, but security is also worth attention, such as a user under the system management has the most important content, it is best to let users have a separate user group, or the user under the permissions of the file is set to fully private In addition, the root user group is generally not easy to add ordinary users to enter,

2,/etc/group content specific analysis
The content of/etc/group includes user group, user group password, GID, and user group, a record of each user group, in the following format:
Group_name:passwd:GID:user_list

Each record in/etc/group is divided into four fields:
First field: User group name;
Second field: User group password;
Third field: GID
The fourth field: User list, with each user, the number is divided; This field can be empty, if the word blank indicates the user group is the GID user name;
============================================================================
Overview of Linux User and user group management
Reference URL: http://fedora.linuxsir.org/main/?q=node/91
One, the understanding of Linux single-user multi-tasking, multi-user multi-tasking concept;

Linux is a multi-user, multi-tasking operating system, we should understand the single-user multi-tasking and multi-user multi-tasking concept;

1, Linux Single-user multi-tasking;
Single user multitasking; For example, when we log into the system with Beinan, I want to open gedit to write the document, but in the process of writing the document, I feel less music, so open the Xmms to some music, of course, listen to some music, MSN still have to open, want to know what a few brothers are doing now, Like this, I am using Beinan user login, executed gedit, XMMS and MSN, and of course, the input method fcitx; This is a bit simpler, a Beinan user, in order to complete the work, carried out a few tasks; Of course Beinan this user, Others can also do other things by logging in remotely.

2, Linux Multi-user, multi-tasking;
Sometimes it may be a lot of users at the same time with the same system, but not all users must do the same thing, so this has a multi-user multi-tasking said;

For example, such as the linuxsir.org server, which has FTP users, system administrators, Web users, regular users, and so on, at the same time, may have some brothers are visiting the forum, some may be uploading package management sub-station, such as Luma or yuking Brother in the management of their home system and FTP; At the same time, there may be a system administrator to maintain the system, browse the homepage is used by the nobody users, everyone with the same, and upload the package with the FTP user, the administrator of the system maintenance or review, May use a normal account or Superuser root account, different users have different permissions, to complete different tasks need different users, can also say that different users, may be completed work is not the same;

Noteworthy is: Multi-user multi-tasking is not everyone at the same time squeezed to a machine in the keyboard and display to operate the machine, multi-user may be through remote login, such as remote control of the server, as long as there is user rights can be up to anyone to operate or access;

3, the role of users to distinguish;
Users in the system are sub-roles, in the Linux system, due to different roles, permissions and the tasks completed are different; it is noteworthy that the user's role is through UID and identification, especially UID; in system management, the system administrator must adhere to the unique characteristics of UID;
Root User: The system is unique, is real, can log on the system, the operating system can be any file and command, with the highest authority;
Virtual User: This kind of user is also called pseudo-user or false user, distinguish from real user, this kind of user does not have the ability to log in system, but it is the user that the system runs indispensable, such as bin, daemon, ADM, ftp, mail, etc., this kind of user is owned by the system itself, not later added, Of course we can also add virtual users;
Ordinary real users: such users can log into the system, but only the contents of their own home directory, limited access, such users are the system administrator to add their own;

4, the security of multi-user operating system;
Multi-user system is more convenient for system management from the fact. From the security point of view, multi-user management of the system more secure, such as Beinan users under a file do not want to let other users see, just set up the file permissions, only Beinan a user readable writable editable on the line, so that only Beinan a user can operate their private files , Linux in multi-user performance is the best, Linux can well protect the security of each user, but we also have to learn that Linux is a safe system, if there is no security-conscious administrator or management technology, such a system is not secure.

From the server point of view, multi-user system security is also the most important, we commonly used Windows operating system, it can only be said that the ability to manage the rights management, there is no way to the Linux or Unix-like system compared;

( user) and user groups (group) concept;

1, the user's concept;
With the understanding of Linux multiuser before, we understand that Linux is the real multi-user operating system, so we can build a number of users in the Linux system. For example, our colleagues want to use my computer, but I do not want him to use my username login, because my user name has not wanted to let others see the information and information (that is, privacy content) then I can give him a new user name, let him use the user name I opened to toss, This is consistent with the operational rules from the point of view of computer security;

Of course the user's concept of understanding is not only this, in the Linux system there are also some users are used to accomplish specific tasks, such as nobody and FTP, we visit linuxsir.org Web program, is nobody users; when we visit FTP anonymously, User FTP or Nobody will be used, if you want to know some of the Linux system account, please check/etc/passwd;

2. The concept of user groups (group);
User groups (group) is a collection of users with the same characteristics, for example, sometimes we want to have multiple users with the same permissions, such as viewing, modifying a file or executing a command, we need the user group, we define the user to the same user group, we modify the file or directory permissions , so that the user group has a certain operation permissions, so that users under the user group has the same permissions to the file or directory, which we define the group and modify the file permissions to achieve;

For example, in order for some users to have permission to view a document, such as a schedule, and the person who writes the timesheet has permission to read and write, we want some users to know the content of the timesheet without letting them modify it, so we can put these users into a group and then modify the permissions of the file. Make the user group readable so that each user under the user group is readable;

The correspondence between users and user groups is: one-to-many, one or one-to-many or many-to-many;
Single: A user can be the only member of a group;
Many-to-one: multiple users can be a member of a unique group, not belong to other user groups, such as Beinan and Linuxsir two users only belong to the Beinan user group;
One-to-many: a user can be a member of more than one user group, for example, Beinan can be a member of the root group or a member of the Linuxsir user group, or it can be a team of ADM users;
Many-to-many: multiple users correspond to multiple user groups, and several users can belong to the same group, in fact, many-to-many relationship is the extension of the previous three, understand the above three, this article can also understand;

View all users and all user groups under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.