On Unix-like operating systems, the groupadd command creates a new group.

This page describes the GNU/Linux version of groupadd.

Description

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

  • Description
  • Syntax
  • Configuration
  • Examples
  • Related commands
  • Linux commands help

Syntax

groupadd [options] group

Options

Configuration

The following configuration variables in /etc/login.defs change the behavior of this tool:

GID_MAX (number), GID_MIN (number)

Range of group IDs used for the creation of regular groups by useradd, groupadd, or newusers. The default value for GID_MIN (resp. GID_MAX) is 1000 (resp. 60000).

MAX_MEMBERS_PER_GROUP (number)

Maximum members per group entry. When the maximum is reached, a new group entry (line) is started in /etc/group (with the same name, same password, and same GID). The default value is 0, meaning that there are no limits in the number of members in a group. This feature (split group) permits to limit the length of lines in the group file. This is useful to make sure that lines for NIS groups are not larger than 1024 characters. If you need to enforce such limit, you can use 25. Note: split groups may not be supported by all tools (even in the Shadow toolsuite). You should not use this variable unless you need it.

SYS_GID_MAX (number), SYS_GID_MIN (number)

Range of group IDs used for the creation of system groups by useradd, groupadd, or newusers. The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101 (resp. GID_MIN-1).

Examples

groupadd newgroup

The example above would create a new group called “newgroup”. This new group could then have users added to it using the useradd command.

For this command to work, you must have superuser rights or be logged in as root.

gpasswd — Administer /etc/group and /etc/gshadow.groupdel — Remove a group from the system.groupmod — Modify a group definition.useradd — Add a user to the system.