Check the groups to which a user belongs
Check the group in /etc/passwd and /etc/group (check the gid)
Users always belong to a group, and the group described in the /etc/passwd and /etc/group files is the primary group.
The gid (group ID) is stored in the /etc/passwd and /etc/group files
|$ grep sampleuser /etc/passwd|
$ grep sampleuser /etc/group
●Check the group with the id command
The id command specifies the user name as an argument.
The uid displays the user group, the gid displays the primary group, and the affiliation group displays all the groups to which the user belongs.
|$ id sampleuser|
uid=1002(sampleuser) gid=1003(sampleuser) groups=1003(sampleuser)
●Check groups with the groups command
The groups command also requires a user name as an argument
|$ groups sampleuser|
sampleuser : sampleuser
●Display the group list with the getent command
|$ getent group|