sajad torkamani

/etc/group is a text file on Unix systems that defines all the groups on the system and their member users.

Here’s an example /etc/group:

nobody:*:-2:
nogroup:*:-1:
wheel:*:0:root
daemon:*:1:root
kmem:*:2:root
sys:*:3:root
tty:*:4:root
operator:*:5:root
mail:*:6:_teamsserver
bin:*:7:

Each line in the file takes the following format:

<group-name>:<access>:<group-id>:<list-of-user-names>

Let’s take the daemon group from above (daemon:*:1:root) and examine each field:

  • daemon: The name of the group
  • *: Indicates no password is set and you can’t use newgrp to switch to this group. You can also see x here on Linux systems which means you can only switch to this group if you know the password (stored in /etc/gshadow). If it’s empty (rare), you can switch to this group without a password (not secure).
  • 1: The group ID (sometimes referred to as GID).
  • root: The user (only 1 here) belongin to this group