Group Administration

Group Administration in Linux

GROUP Administration

  • Users are assigned to groups with unique group ID numbers (the GID)
  • The group name and GID are stored in /etc/group
  • Each user is given their own private group
  • They can also be added to their groups to gain additional access
  • All users in a group can share files that belong to the group

Each user is a member of at least one group, called a primary group. In addition, a user can be a member of an unlimited number of secondary groups. Group membership can be used to control the files that a user can read and edit. For example, if two users are working on the same project you might put them in the same group so they can edit a particular file that other users cannot access.

  • A user’s primary group is defined in the /etc/passwd file and Secondary groups are defined in the /etc/group
  • The primary group is important because files created by this user will inherit that group affiliation.

Group Administration


Creating a Group with default options:

  • To create a group the syntax is
  • # groupadd  <name for the group>
  • # groupadd kjgroup

Creating a group with user specified group id (GID)

  • # groupadd <option> <name for the group>
  • # groupadd -g 595 kjgroup
  • Verify it in /etc/group

Modifying the properties of the group

To modify the group properties the syntax is

# groupmod <option> <arguments> <group name>

The options are

  • -g to change the group id
  • -o to override the previous assigned id, if it matches with the new one.
  • -n to change the group name

Changing the GID of the group

# groupmod –g 600 kjgroup

Verify it in /etc/group

Changing the name of the group

  • The syntax for changing the group name is
  • # groupmod –n <new name > < existing name >
  • # groupmod –n anand kjgroup

Adding and Removing Members to a Group

Adding the members to the group is to add users to the group. To add the members to the group the syntaxes are

To add single user to the group

# usermod –G <group name > < user name>

# usermod –G kjgroup anand

Adding multiple single or multiple users to the group with various attributes

# gpasswd < option> <arguments> <group name>


  • -M For Adding Multiple users to a group
  • -A for Adding a group Administrator
  • -a for Adding a single user to a group
  • -d removing a user from a group

# gpasswd –M <user>,<user>,<user> <group>

# gpasswd –M kjuser4, kjuser5, kjuser6 kjgroup

Adding a single user using gpasswd

# gpasswd –a kjuser kjgroup (verify it in /etc/group)

Making a user as a administrator

# gpasswd –A kjuser kjgroup (verify it in /etc/gshadow)

Removing a user from the group

# gpasswd –d kjuser2 kjgroup

To add and remove groups use can also use the graphical tool in linux

# system-config-users &

Leave a Comment

Your email address will not be published. Required fields are marked *