{
    "mode": "man",
    "parameter": "groupmod",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/groupmod/8/json",
    "generated": "2026-08-08T00:28:01Z",
    "synopsis": "groupmod [options] GROUP",
    "sections": {
        "NAME": {
            "content": "groupmod - modify a group definition on the system\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "groupmod [options] GROUP\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The groupmod command modifies the definition of the specified GROUP by modifying the\nappropriate entry in the group database.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The options which apply to the groupmod command are:\n",
            "subsections": [
                {
                    "name": "-a --append _",
                    "content": "If group members are specified with -U, append them to the existing member list, rather\nthan replacing it.\n",
                    "flag": "-a",
                    "long": "--append"
                },
                {
                    "name": "-g --gid _",
                    "content": "The group ID of the given GROUP will be changed to GID.\n\nThe value of GID must be a non-negative decimal integer. This value must be unique,\nunless the -o option is used.\n\nUsers who use the group as primary group will be updated to keep the group as their\nprimary group.\n\nAny files that have the old group ID and must continue to belong to GROUP, must have\ntheir group ID changed manually.\n\nNo checks will be performed with regard to the GIDMIN, GIDMAX, SYSGIDMIN, or\nSYSGIDMAX from /etc/login.defs.\n",
                    "flag": "-g",
                    "long": "--gid"
                },
                {
                    "name": "-h --help",
                    "content": "Display help message and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-n --new-name _",
                    "content": "The name of the group will be changed from GROUP to NEWGROUP name.\n",
                    "flag": "-n",
                    "long": "--new-name"
                },
                {
                    "name": "-o --non-unique",
                    "content": "When used with the -g option, allow to change the group GID to a non-unique value.\n",
                    "flag": "-o",
                    "long": "--non-unique"
                },
                {
                    "name": "-p --password _",
                    "content": "The encrypted password, as returned by crypt(3).\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 --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 in the PREFIXDIR directory and use the configuration files from the\nPREFIXDIR directory. This option does not chroot and is intended for preparing a\ncross-compilation target. Some limitations: NIS and LDAP users/groups are not verified.\nPAM authentication is 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": "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"
                }
            ]
        },
        "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\n/etc/passwd\nUser account information.\n",
            "subsections": []
        },
        "EXIT VALUES": {
            "content": "The groupmod command exits with the following values:\n\n0\nESUCCESS: success\n\n2\nEUSAGE: invalid command syntax\n\n3\nEBADARG: invalid argument to option\n\n4\nEGIDINUSE: group id already in use\n\n6\nENOTFOUND: specified group doesn't exist\n\n9\nENAMEINUSE: group name already in use\n\n10\nEGRPUPDATE: can't update group file\n\n11\nECLEANUPSERVICE: can't setup cleanup service\n\n12\nEPAMUSERNAME: can't determine your username for use with pam\n\n13\nEPAMERROR: pam returned an error, see syslog facility id groupmod for the PAM error\nmessage\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "chfn(1), chsh(1), passwd(1), gpasswd(8), groupadd(8), groupdel(8), login.defs(5), useradd(8),\nuserdel(8), usermod(8).\n\nshadow-utils 4.13                            05/30/2024                                  GROUPMOD(8)",
            "subsections": []
        }
    },
    "summary": "groupmod - modify a group definition on the system",
    "flags": [
        {
            "flag": "-a",
            "long": "--append",
            "arg": null,
            "description": "If group members are specified with -U, append them to the existing member list, rather than replacing it."
        },
        {
            "flag": "-g",
            "long": "--gid",
            "arg": null,
            "description": "The group ID of the given GROUP will be changed to GID. The value of GID must be a non-negative decimal integer. This value must be unique, unless the -o option is used. Users who use the group as primary group will be updated to keep the group as their primary group. Any files that have the old group ID and must continue to belong to GROUP, must have their group ID changed manually. No checks will be performed with regard to the GIDMIN, GIDMAX, SYSGIDMIN, or SYSGIDMAX from /etc/login.defs."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help message and exit."
        },
        {
            "flag": "-n",
            "long": "--new-name",
            "arg": null,
            "description": "The name of the group will be changed from GROUP to NEWGROUP name."
        },
        {
            "flag": "-o",
            "long": "--non-unique",
            "arg": null,
            "description": "When used with the -g option, allow to change the group GID to a non-unique value."
        },
        {
            "flag": "-p",
            "long": "--password",
            "arg": null,
            "description": "The encrypted password, as returned by crypt(3). 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": "--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 in the PREFIXDIR directory and use the configuration files from the PREFIXDIR directory. 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": "groupadd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/groupadd/8/json"
        },
        {
            "name": "groupdel",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/groupdel/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"
        }
    ]
}