Can you explain me the format of /etc/group user group file under Linux / UNIX operating systems?
/etc/group is a text file which defines the groups to which users belong under Linux and UNIX operating system. Under Unix / Linux multiple users can be categorized into groups. Unix file system permissions are organized into three classes, user, group, and others. The use of groups allows additional abilities to be delegated in an organized fashion, such as access to disks, printers, and other peripherals. This method, amongst others, also enables the Superuser to delegate some administrative tasks to normal users.
It stores group information or defines the user groups i.e. it defines the groups to which users belong. There is one entry per line, and each line has the following format (all fields are separated by a colon (:)
cdrom:x:24:vivek,student13,raj_____ _ _ _____| | | || | | |1 2 3 4
Where,
Users on Linux and UNIX systems are assigned to one or more groups for the following reasons:

(Fig.01: Understanding groups)
User tom is part of both 'Web developers' and 'Sales' group. So tom can access files belongs to both groups.
Type any one of the following command:
$ less /etc/group
OR
$ more /etc/group
Type the following command:
$ groups {username}
$ groups
$ groups vivek
Sample outputs:
vivek : vivek adm dialout cdrom plugdev lpadmin netdev admin sambashare libvirtd
Use the id command to display information about the given user.
$ id -g
$ id -g user
$ id -g vivek
OR
$ id -gn vivek
$ id -G
$ id -G user
$ id -G vivek
OR
$ id -Gn vivek
聯(lián)系客服