Linux System User Group management
Linux supports user groups, which are collections of users with the same characteristics; A group can contain multiple users, and each user can also belong to a different group user group to logically organize user accounts together, which allows the user to share files within the group. Each file on the system has one user and one group owner; use the ls–l command to see the host and group of each file. (User groups play an important role in Linux, allowing administrators to centrally manage users).
1. The Linux User group is divided into the following two categories:
Private groups: Groups created automatically when a user is created
Standard Group: A group that can contain multiple users
2, the data file of the group/etc/group
Function: Store System Group information
Format: User group name: Password: Administrator of user group: List of Members
Cases:
3, the data file of the group/etc/gshadow
The/etc/gshadow file is used to define user group passwords, group administrators, and so on, which can only be read by the root user.
Cases:
Format: Group name: encrypted password: Group Manager: Group member
Explain:
Group name: identification symbol for a group
Encrypted password: if "!!" is displayed, this group does not have a password.
Group Manager: The right to add and remove users from this group.
Members of a group: separated by "," between multiple member names.
4. Management of group account
(1) Set up a group
Format: #groupadd [options] Group name
Parameters:
- G GID //Specify GID value for new group
Cases:
To see if the build was successful:
(2) Delete a group
Format: #groupdel Group name
Cases:
See if a group has been deleted:
(3) Modify the information of the group
Format:
#groupmod [Options] Group name
Options:
-N New group name original group name//modify Group name
- G GID //Modify the GID of the group
Cases:
To see if the success has been modified:
(4) Add/Remove group members, or change group password
Format:
#gpasswd [Options] [user name] [group name]
Options:
-a username//Add a user to the specified group
-D user name//remove user from specified group
-r//Remove group password
Cases:
To see if a success has been added:
(5) Displays the group to which the user belongs
Format: #groups [user name]
Cases:
Linux System User Group management