{
    "mode": "man",
    "parameter": "groupmems",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/groupmems/8/json",
    "generated": "2026-06-13T14:48:12Z",
    "synopsis": "groupmems -a username | -d username | [-g groupname] | -l | -p",
    "sections": {
        "NAME": {
            "content": "groupmems - administer members of a user's primary group\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "groupmems -a username | -d username | [-g groupname] | -l | -p\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The groupmems command allows a user to administer their own group membership list without the\nrequirement of superuser privileges. The groupmems utility is for systems that configure its\nusers to be in their own name sake primary group (i.e., guest / guest).\n\nOnly the superuser, as administrator, can use groupmems to alter the memberships of other\ngroups.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The options which apply to the groupmems command are:\n",
            "subsections": [
                {
                    "name": "-a --add",
                    "content": "Add a user to the group membership list.\n\nIf the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a\nnew entry will be created.\n",
                    "flag": "-a",
                    "long": "--add"
                },
                {
                    "name": "-d --delete",
                    "content": "Delete a user from the group membership list.\n\nIf the /etc/gshadow file exist, the user will be removed from the list of members and\nadministrators of the group.\n\nIf the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a\nnew entry will be created.\n",
                    "flag": "-d",
                    "long": "--delete"
                },
                {
                    "name": "-g --group",
                    "content": "The superuser can specify which group membership list to modify.\n",
                    "flag": "-g",
                    "long": "--group"
                },
                {
                    "name": "-h --help",
                    "content": "Display help message and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-l --list",
                    "content": "List the group membership list.\n",
                    "flag": "-l",
                    "long": "--list"
                },
                {
                    "name": "-p --purge",
                    "content": "Purge all users from the group membership list.\n\nIf the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a\nnew entry will be created.\n",
                    "flag": "-p",
                    "long": "--purge"
                },
                {
                    "name": "-R --root",
                    "content": "Apply changes in the CHROOTDIR directory and use the configuration files from the\nCHROOTDIR directory.\n",
                    "flag": "-R",
                    "long": "--root"
                }
            ]
        },
        "SETUP": {
            "content": "The groupmems executable should be in mode 2710 as user root and in group groups. The system\nadministrator can add users to group groups to allow or disallow them using the groupmems\nutility to manage their own group membership list.\n\n$ groupadd -r groups\n$ chmod 2710 groupmems\n$ chown root.groups groupmems\n$ groupmems -g groups -a gk4\n\n",
            "subsections": []
        },
        "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",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "chfn(1), chsh(1), passwd(1), groupadd(8), groupdel(8), useradd(8), userdel(8), usermod(8).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                 GROUPMEMS(8)",
            "subsections": []
        }
    },
    "summary": "groupmems - administer members of a user's primary group",
    "flags": [
        {
            "flag": "-a",
            "long": "--add",
            "arg": null,
            "description": "Add a user to the group membership list. If the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a new entry will be created."
        },
        {
            "flag": "-d",
            "long": "--delete",
            "arg": null,
            "description": "Delete a user from the group membership list. If the /etc/gshadow file exist, the user will be removed from the list of members and administrators of the group. If the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a new entry will be created."
        },
        {
            "flag": "-g",
            "long": "--group",
            "arg": null,
            "description": "The superuser can specify which group membership list to modify."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help message and exit."
        },
        {
            "flag": "-l",
            "long": "--list",
            "arg": null,
            "description": "List the group membership list."
        },
        {
            "flag": "-p",
            "long": "--purge",
            "arg": null,
            "description": "Purge all users from the group membership list. If the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a new entry will be created."
        },
        {
            "flag": "-R",
            "long": "--root",
            "arg": null,
            "description": "Apply changes in the CHROOTDIR directory and use the configuration files from the CHROOTDIR directory."
        }
    ],
    "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": "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": "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"
        }
    ]
}