-
Notifications
You must be signed in to change notification settings - Fork 0
Viewing User Group Information
Every user is assigned an unique user ID (uid) in Linux.
Linux uses groups for organizing users and handling permissions. Each group has a unique ID (gid) assigned to it and each users is assigned to a default group which has the same id number as the users.
Groups membership is controlled by the /etc/group file which has a list of groups and it’s members.
To view the information in the /etc/group file simply type less /etc/group. When you run the less /etc/group command you should see something like the screen shot below.

Each line in the file is for a different group. The format of each line is Group Name:Password:GroupID (GID):User list.
For example the adm:x:4:syslog,kristina line means:
- Group name = adm
- Password = no password (x means no password)
- Group ID (GID) = 4
- Users in the group = syslog and kristina
Most groups don’t have a password as you can see from the screen shot above.
To view what groups a user is a part of you can use the following commands:
1.groups (username)

2.groups (shows groups that the current user is assigned to)

3.id -g (this command will get the current user’s unique group id)

4.id -g (username) (this command will get the user’s unique group id)

5.id -G (this command will list all the group ids (GID) that the current user is a member of)

6.id -G (username) (this command will list all the groups ids (GID) that the user is a member of)

Always Learning
- Home
- Websites
- Linux
- Java
- Gradle
- JUnit
- Database