Vol. I · No. 46The command line sectionSat, 10 Oct 2026
Linux · users & permissions

groupadd

create a group

groupadd adds a group to the system. A group is a named set of users who can be granted access together: create it, add people to it, and hand a directory to the group instead of to each person.

Three steps to a shared directory: groupadd, usermod -aG, chgrp.

Creates
An entry in /etc/group
with the next free id
Add members
usermod -aG
or gpasswd -a
Remove it
groupdel NAME
files keep the bare id
List members
getent group NAME
no root needed

At the terminal

Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.

root@netflow — bashpasswd
# groupadd developers
1# usermod -aG developers asha
2# getent group developers
developers:x:1005:asha
3# mkdir /srv/project && chgrp developers /srv/project
4# chmod 2775 /srv/project
# ls -ld /srv/project
drwxrwsr-x 2 root developers 4096 Sep 30 11:45 /srv/project
Illustrative session · names, sizes and dates are examples, and every address is from a documentation or private range
Reading the output

What the numbered lines are telling you

1
Put someone in it

The group exists but is empty until members are added.

2
The group record

Name, a password placeholder, the group id, and the list of members.

3
Give the group a directory

The directory now belongs to the developers group.

4
The leading 2 is set-gid

Shown as the s in rws. Files created inside inherit the developers group, so everything in the directory stays shared.

Switches

A switch changes how the command behaves. These are the ones used day to day; man groupadd lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.

-g GID
Use this group id.
-r
Create a system group, with a low id.
-f
Exit successfully if the group already exists.

Variations worth knowing

The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.

sudo gpasswd -a ravi developers

Adds a user to a group.

sudo gpasswd -d ravi developers

Removes a user from a group.

sudo groupdel developers

Deletes a group.

cat /etc/group | cut -d: -f1

Lists every group on the system.

In cybersecurity

Groups are how access is granted without handing out root.

Grant to groups, not to everyone

A shared directory owned by a group and closed to others is the right answer. chmod 777 is the wrong one.

Keep membership current

People change teams. A group whose membership is never reviewed slowly comes to include everyone.

Set-gid directories

They keep shared files in the right group, but check that only intended members can write there — whoever can, can alter everyone’s files.

Filed under

Users & permissions

Read alongside