/etc/group file in Ubuntu

When we add a group, it stores information about the group in /etc/group file in Ubuntu. For every group we create, there is a corresponding single-line entry in /etc/group file. The single-line entry is further divided in four fields separated by colons(:).

The four fields are about –

  1. Group Name,
  2. Password,
  3. Group ID and,
  4. List of users.

/etc/group file in Ubuntu

Use cat command-line utility to view contents of the file –

cat /etc/group

The first field here signifies Group Name. The second field is about the Password. If this field is empty then, no password is required. And, if there is ‘x’ here then it shows encrypted group password. The third field is Group ID, it stores the unique numeric value of the Group ID here.

Lastly, we have list of users. Basically, it contains a list of users who are members of this particular group. Multiple users who are part of the group are separated by commas(,). As soon as we create a user, unless otherwise specified – it gets to be a part of primary group which has the same name as that of user.

The /etc/passwd file shows us the information about primary group a user belongs it. More about /etc/password here. But, if a user is a part of more than one group. Then, that secondary group information is listed here in /etc/group file.

So, we can check how many groupsĀ  a user is part of through /etc/group file as well.

In conclusion, we have covered /etc/group file in Ubuntu here.

Additional Info –

Alternately, we can use id command-line utility to see more information about the user. Just use the following in the terminal –

id <user_name>

For instance, if we have a user ‘abc’ then,

id abc

Similar Posts