{
    "mode": "man",
    "parameter": "GROUPADD",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/GROUPADD/8/json",
    "generated": "2026-11-10T09:00:07Z",
    "synopsis": "groupadd [OPTIONS] NEWGROUP",
    "sections": {
        "NAME": {
            "content": "groupadd - create a new group\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "groupadd [OPTIONS] NEWGROUP\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The groupadd command creates a new group account using the values specified on the command\nline plus the default values from the system. The new group will be entered into the system\nfiles as needed.\n\nGroupnames may contain only lower and upper case letters, digits, underscores, or dashes.\nThey can end with a dollar sign. Dashes are not allowed at the beginning of the groupname.\nFully numeric groupnames and groupnames . or .. are also disallowed.\n\nOn Debian, the only constraints are that groupnames must neither start with a dash ('-') nor\nplus ('+') nor tilde ('~') nor contain a colon (':'), a comma (','), or a whitespace (space:'\n', end of line: '\\n', tabulation: '\\t', etc.).\n\nOn Ubuntu, the same constraints as Debian are in place, with the additional constraint that\nthe groupname cannot be fully numeric. This includes octal and hexadecimal syntax.\n\nGroupnames may only be up to 32 characters long.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The options which apply to the groupadd command are:\n",
            "subsections": [
                {
                    "name": "-f --force",
                    "content": "This option causes the command to simply exit with success status if the specified group\nalready exists. When used with -g, and the specified GID already exists, another (unique)\nGID is chosen (i.e.  -g is turned off).\n",
                    "flag": "-f",
                    "long": "--force"
                },
                {
                    "name": "-g --gid",
                    "content": "The numerical value of the group's ID.  GID must be unique, unless the -o option is used.\nThe value must be non-negative. The default is to use the smallest ID value greater than\nor equal to GIDMIN and greater than every other group.\n\nSee also the -r option and the GIDMAX description.\n",
                    "flag": "-g",
                    "long": "--gid"
                },
                {
                    "name": "-h --help",
                    "content": "Display help message and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-K --key",
                    "content": "Overrides /etc/login.defs defaults (GIDMIN, GIDMAX and others). Multiple -K options can\nbe specified.\n\nExample: -K GIDMIN=100  -K GIDMAX=499\n\nNote: -K GIDMIN=10,GIDMAX=499 doesn't work yet.\n",
                    "flag": "-K",
                    "long": "--key"
                },
                {
                    "name": "-o --non-unique",
                    "content": "permits the creation of a group with an already used numerical ID. As a result, for this\nGID, the mapping towards group NEWGROUP may not be unique.\n",
                    "flag": "-o",
                    "long": "--non-unique"
                },
                {
                    "name": "-p --password",
                    "content": "defines an initial password for the group account. PASSWORD is expected to be encrypted,\nas returned by crypt (3).\n\nWithout this option, the group account will be locked and with no password defined, i.e.\na single exclamation mark in the respective field of ths system account file /etc/group\nor /etc/gshadow.\n\nNote: This option is not recommended because the password (or encrypted password) will be\nvisible by users listing the processes.\n\nYou should make sure the password respects the system's password policy.\n",
                    "flag": "-p",
                    "long": "--password"
                },
                {
                    "name": "-r --system",
                    "content": "Create a system group.\n\nThe numeric identifiers of new system groups are chosen in the SYSGIDMIN-SYSGIDMAX\nrange, defined in login.defs, instead of GIDMIN-GIDMAX.\n",
                    "flag": "-r",
                    "long": "--system"
                },
                {
                    "name": "-R --root",
                    "content": "Apply changes in the CHROOTDIR directory and use the configuration files from the\nCHROOTDIR directory. Only absolute paths are supported.\n",
                    "flag": "-R",
                    "long": "--root"
                },
                {
                    "name": "-P --prefix",
                    "content": "Apply changes to configuration files under the root filesystem found under the directory\nPREFIXDIR. This option does not chroot and is intended for preparing a cross-compilation\ntarget. Some limitations: NIS and LDAP users/groups are not verified. PAM authentication\nis using the host files. No SELINUX support.\n",
                    "flag": "-P",
                    "long": "--prefix"
                },
                {
                    "name": "-U --users",
                    "content": "A list of usernames to add as members of the group.\n\nThe default behavior (if the -g, -N, and -U options are not specified) is defined by the\nUSERGROUPSENAB variable in /etc/login.defs.\n",
                    "flag": "-U",
                    "long": "--users"
                }
            ]
        },
        "CONFIGURATION": {
            "content": "The following configuration variables in /etc/login.defs change the behavior of this tool:\n",
            "subsections": [
                {
                    "name": "GID_MAX (number), GID_MIN (number)",
                    "content": "Range of group IDs used for the creation of regular groups by useradd, groupadd, or\nnewusers.\n\nThe default value for GIDMIN (resp.  GIDMAX) is 1000 (resp. 60000).\n"
                },
                {
                    "name": "MAX_MEMBERS_PER_GROUP (number)",
                    "content": "Maximum members per group entry. When the maximum is reached, a new group entry (line) is\nstarted in /etc/group (with the same name, same password, and same GID).\n\nThe default value is 0, meaning that there are no limits in the number of members in a\ngroup.\n\nThis feature (split group) permits to limit the length of lines in the group file. This\nis useful to make sure that lines for NIS groups are not larger than 1024 characters.\n\nIf you need to enforce such limit, you can use 25.\n\nNote: split groups may not be supported by all tools (even in the Shadow toolsuite). You\nshould not use this variable unless you really need it.\n"
                },
                {
                    "name": "SYS_GID_MAX (number), SYS_GID_MIN (number)",
                    "content": "Range of group IDs used for the creation of system groups by useradd, groupadd, or\nnewusers.\n\nThe default value for SYSGIDMIN (resp.  SYSGIDMAX) is 101 (resp.  GIDMIN-1).\n"
                }
            ]
        },
        "FILES": {
            "content": "/etc/group\nGroup account information.\n\n/etc/gshadow\nSecure group account information.\n\n/etc/login.defs\nShadow password suite configuration.\n",
            "subsections": []
        },
        "CAVEATS": {
            "content": "You may not add a NIS or LDAP group. This must be performed on the corresponding server.\n\nIf the groupname already exists in an external group database such as NIS or LDAP, groupadd\nwill deny the group creation request.\n",
            "subsections": []
        },
        "EXIT VALUES": {
            "content": "The groupadd command exits with the following values:\n\n0\nsuccess\n\n2\ninvalid command syntax\n\n3\ninvalid argument to option\n\n4\nGID is already used (when called without -o)\n\n9\ngroup name is already used\n\n10\ncan't update group file\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "chfn(1), chsh(1), passwd(1), gpasswd(8), groupdel(8), groupmod(8), login.defs(5), useradd(8),\nuserdel(8), usermod(8).\n\nshadow-utils 4.13                            05/30/2024                                  GROUPADD(8)",
            "subsections": []
        }
    },
    "summary": "groupadd - create a new group",
    "flags": [
        {
            "flag": "-f",
            "long": "--force",
            "arg": null,
            "description": "This option causes the command to simply exit with success status if the specified group already exists. When used with -g, and the specified GID already exists, another (unique) GID is chosen (i.e. -g is turned off)."
        },
        {
            "flag": "-g",
            "long": "--gid",
            "arg": null,
            "description": "The numerical value of the group's ID. GID must be unique, unless the -o option is used. The value must be non-negative. The default is to use the smallest ID value greater than or equal to GIDMIN and greater than every other group. See also the -r option and the GIDMAX description."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help message and exit."
        },
        {
            "flag": "-K",
            "long": "--key",
            "arg": null,
            "description": "Overrides /etc/login.defs defaults (GIDMIN, GIDMAX and others). Multiple -K options can be specified. Example: -K GIDMIN=100 -K GIDMAX=499 Note: -K GIDMIN=10,GIDMAX=499 doesn't work yet."
        },
        {
            "flag": "-o",
            "long": "--non-unique",
            "arg": null,
            "description": "permits the creation of a group with an already used numerical ID. As a result, for this GID, the mapping towards group NEWGROUP may not be unique."
        },
        {
            "flag": "-p",
            "long": "--password",
            "arg": null,
            "description": "defines an initial password for the group account. PASSWORD is expected to be encrypted, as returned by crypt (3). Without this option, the group account will be locked and with no password defined, i.e. a single exclamation mark in the respective field of ths system account file /etc/group or /etc/gshadow. Note: This option is not recommended because the password (or encrypted password) will be visible by users listing the processes. You should make sure the password respects the system's password policy."
        },
        {
            "flag": "-r",
            "long": "--system",
            "arg": null,
            "description": "Create a system group. The numeric identifiers of new system groups are chosen in the SYSGIDMIN-SYSGIDMAX range, defined in login.defs, instead of GIDMIN-GIDMAX."
        },
        {
            "flag": "-R",
            "long": "--root",
            "arg": null,
            "description": "Apply changes in the CHROOTDIR directory and use the configuration files from the CHROOTDIR directory. Only absolute paths are supported."
        },
        {
            "flag": "-P",
            "long": "--prefix",
            "arg": null,
            "description": "Apply changes to configuration files under the root filesystem found under the directory PREFIXDIR. This option does not chroot and is intended for preparing a cross-compilation target. Some limitations: NIS and LDAP users/groups are not verified. PAM authentication is using the host files. No SELINUX support."
        },
        {
            "flag": "-U",
            "long": "--users",
            "arg": null,
            "description": "A list of usernames to add as members of the group. The default behavior (if the -g, -N, and -U options are not specified) is defined by the USERGROUPSENAB variable in /etc/login.defs."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "chfn",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/chfn/1/json"
        },
        {
            "name": "chsh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/chsh/1/json"
        },
        {
            "name": "passwd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/passwd/1/json"
        },
        {
            "name": "gpasswd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/gpasswd/8/json"
        },
        {
            "name": "groupdel",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/groupdel/8/json"
        },
        {
            "name": "groupmod",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/groupmod/8/json"
        },
        {
            "name": "login.defs",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/login.defs/5/json"
        },
        {
            "name": "useradd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/useradd/8/json"
        },
        {
            "name": "userdel",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/userdel/8/json"
        },
        {
            "name": "usermod",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/usermod/8/json"
        }
    ]
}