$linuxjunkies
>

groupadd(8)

Create a new group account on the system.

UbuntuDebianFedoraArch

Synopsis

groupadd [OPTION]... group

Description

groupadd creates a new group account using the values specified on the command line plus the default values from the system. The new group will be entered into the system files as needed.

By default, groupadd creates a group with the next available GID (Group ID). You can specify a particular GID, set a password, or mark the group as a system group.

Common options

FlagWhat it does
-g GIDUse GID as the group ID instead of auto-generating one
-fForce the GID to be accepted even if it already exists
-rCreate a system group (GID below system range, typically < 1000)
-p PASSWORDSet an encrypted password for the group (rarely used)
-K KEY=VALUEOverride /etc/default/useradd defaults, e.g., -K GID_MIN=100
-oAllow creating groups with duplicate GID values

Examples

Create a new group called 'developers' with the next available GID

sudo groupadd developers

Create a group named 'webadmins' with GID 1500

sudo groupadd -g 1500 webadmins

Create a system group with a GID below 1000

sudo groupadd -r sysgroup

Create a system group with the specific GID 999

sudo groupadd -g 999 -r www-data

Create a group using custom GID range settings instead of defaults

sudo groupadd -K GID_MIN=2000 -K GID_MAX=3000 testgroup

Related commands