HxHippy

groupadd

Create a new group

Overview

Creates a new group account using the values specified on the command line plus the default values from the system.

Syntax

groupadd [OPTION]... GROUP_NAME

Common Options

-g GID, --gid GID

Use GID for the new group. The GID must be a non-negative integer. This value must be unique, unless the -o option is used.

-o, --non-unique

Allow creation of a group with a non-unique (duplicate) GID (used with -g).

-r, --system

Create a system group. System groups are usually those needed by system services and often have GIDs in a specific low range.

-f, --force

Exit successfully if the specified group already exists. If used with -g and the specified GID already exists, the command will fail (unless -o is also used).

-p PASSWORD, --password PASSWORD

Use this encrypted password for the new group. Note: This option is generally not recommended as group passwords are rarely used on modern Linux systems.

Examples

$ sudo groupadd developers

Creates a new group named developers.

$ sudo groupadd -g 1005 projectalpha

Creates a group projectalpha with a specific GID 1005.

$ sudo groupadd -r webadmins

Creates a system group named webadmins.

$ sudo groupadd -f existing_group_name

If existing_group_name already exists, the command will exit successfully without an error.

groupaccountaddcreatepermissionsgroupadd