groupadd(8)
Create a new group account on the system.
UbuntuDebianFedoraArch
Synopsis
groupadd [OPTION]... groupDescription
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
| Flag | What it does |
|---|---|
-g GID | Use GID as the group ID instead of auto-generating one |
-f | Force the GID to be accepted even if it already exists |
-r | Create a system group (GID below system range, typically < 1000) |
-p PASSWORD | Set an encrypted password for the group (rarely used) |
-K KEY=VALUE | Override /etc/default/useradd defaults, e.g., -K GID_MIN=100 |
-o | Allow creating groups with duplicate GID values |
Examples
Create a new group called 'developers' with the next available GID
sudo groupadd developersCreate a group named 'webadmins' with GID 1500
sudo groupadd -g 1500 webadminsCreate a system group with a GID below 1000
sudo groupadd -r sysgroupCreate a system group with the specific GID 999
sudo groupadd -g 999 -r www-dataCreate a group using custom GID range settings instead of defaults
sudo groupadd -K GID_MIN=2000 -K GID_MAX=3000 testgroup