reference source
https://www.bilibili.com/video/BV187411y7hF?spm_id_from=333.999.0.0
Version
This article is based on CentOS 7.6
Overview
All information about user groups is stored in the /etc/group file.
Grouping users is a means of managing users and controlling access rights in Linux systems.
Every user belongs to a certain user group.
A group can have multiple users, and a user can belong to different groups.
When a user is a member of multiple groups at the same time, the main group to which the user belongs is recorded in the /etc/passwd file, that is, the default group to which the user belongs when logging in, and other groups are called additional groups .
When a user wants to access a file belonging to an additional group, he must first use the newgrp
command to make himself a member of the group to be accessed.
document content
[root@sail etc]# cat /etc/group
root:x:0:
bin:x:1:
daemon:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mem:x:8:
kmem:x:9:
wheel:x:10:
cdrom:x:11:
mail:x:12:postfix
man:x:15:
dialout:x:18:
floppy:x:19:
games:x:20:
tape:x:33:
video:x:39:
ftp:x:50:
lock:x:54:
audio:x:63:
nobody:x:99:
users:x:100:
utmp:x:22:
utempter:x:35:
input:x:999:
systemd-journal:x:190:
systemd-network:x:192:
dbus:x:81:
polkitd:x:998:
ssh_keys:x:997:
sshd:x:74:
postdrop:x:90:
postfix:x:89:
chrony:x:996:
ntp:x:38:
tcpdump:x:72:
nscd:x:28:
admin:x:1000:
cgred:x:995:
docker:x:994:
The format of this file is also similar to the /etc/passwd file, with 4 fields separated by : .
组名:口令:组标识号:组内用户列表
group name
The name of the user group, consisting of letters or numbers.
As with login names in /etc/passwd , group names should not be repeated.
password
The encrypted password of the user group.
Generally, the user group of Linux system does not have a password, that is, this field is generally empty, or *****.
group identification number
Similar to the user identification number, it is also an integer used internally by the system to identify groups.
List of users in the group
A list of all users belonging to this group , separated by , between different users .
This user group may be the user's primary group, or it may be an additional group.