{
    "content": [
        {
            "type": "text",
            "text": "# gpasswd (man)\n\n## NAME\n\ngpasswd - administer /etc/group and /etc/gshadow\n\n## SYNOPSIS\n\ngpasswd [option] group\n\n## DESCRIPTION\n\nThe gpasswd command is used to administer /etc/group, and /etc/gshadow. Every group can have\nadministrators, members and a password.\n\n## TLDR\n\n> Administer `/etc/group` and `/etc/gshadow`.\n\n- Define group administrators:\n  `sudo gpasswd {{-A|--administrators}} {{user1,user2}} {{group}}`\n- Set the list of group members:\n  `sudo gpasswd {{-M|--members}} {{user1,user2}} {{group}}`\n- Create a password for the named group:\n  `gpasswd {{group}}`\n- Add a user to the named group:\n  `gpasswd {{-a|--add}} {{user}} {{group}}`\n- Remove a user from the named group:\n  `gpasswd {{-d|--delete}} {{user}} {{group}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (1 subsections)\n- **OPTIONS** (8 subsections)\n- **CAVEATS**\n- **CONFIGURATION** (4 subsections)\n- **FILES**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "gpasswd",
        "section": "",
        "mode": "man",
        "summary": "gpasswd - administer /etc/group and /etc/gshadow",
        "synopsis": "gpasswd [option] group",
        "tldr_summary": "Administer `/etc/group` and `/etc/gshadow`.",
        "tldr_examples": [
            {
                "description": "Define group administrators",
                "command": "sudo gpasswd {{-A|--administrators}} {{user1,user2}} {{group}}"
            },
            {
                "description": "Set the list of group members",
                "command": "sudo gpasswd {{-M|--members}} {{user1,user2}} {{group}}"
            },
            {
                "description": "Create a password for the named group",
                "command": "gpasswd {{group}}"
            },
            {
                "description": "Add a user to the named group",
                "command": "gpasswd {{-a|--add}} {{user}} {{group}}"
            },
            {
                "description": "Remove a user from the named group",
                "command": "gpasswd {{-d|--delete}} {{user}} {{group}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-a",
                "long": "--add",
                "arg": null,
                "description": "Add the user to the named group."
            },
            {
                "flag": "-d",
                "long": "--delete",
                "arg": null,
                "description": "Remove the user from the named group."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Display help message and exit."
            },
            {
                "flag": "-Q",
                "long": "--root",
                "arg": null,
                "description": "Apply changes in the CHROOTDIR directory and use the configuration files from the CHROOTDIR directory."
            },
            {
                "flag": "-r",
                "long": "--remove-password",
                "arg": null,
                "description": "Remove the password from the named group. The group password will be empty. Only group members will be allowed to use newgrp to join the named group."
            },
            {
                "flag": "-R",
                "long": "--restrict",
                "arg": null,
                "description": "Restrict the access to the named group. The group password is set to \"!\". Only group members with a password will be allowed to use newgrp to join the named group."
            },
            {
                "flag": "-A",
                "long": "--administrators",
                "arg": null,
                "description": "Set the list of administrative users."
            },
            {
                "flag": "-M",
                "long": "--members",
                "arg": null,
                "description": "Set the list of group members."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "newgrp",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/newgrp/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": "groupmod",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/groupmod/8/json"
            },
            {
                "name": "grpck",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/grpck/8/json"
            },
            {
                "name": "group",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/group/5/json"
            },
            {
                "name": "gshadow",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/gshadow/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 12,
                "subsections": [
                    {
                        "name": "Notes about group passwords",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 4,
                "subsections": [
                    {
                        "name": "-a --add",
                        "lines": 2,
                        "flag": "-a",
                        "long": "--add"
                    },
                    {
                        "name": "-d --delete",
                        "lines": 2,
                        "flag": "-d",
                        "long": "--delete"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-Q --root",
                        "lines": 3,
                        "flag": "-Q",
                        "long": "--root"
                    },
                    {
                        "name": "-r --remove-password",
                        "lines": 3,
                        "flag": "-r",
                        "long": "--remove-password"
                    },
                    {
                        "name": "-R --restrict",
                        "lines": 3,
                        "flag": "-R",
                        "long": "--restrict"
                    },
                    {
                        "name": "-A --administrators",
                        "lines": 2,
                        "flag": "-A",
                        "long": "--administrators"
                    },
                    {
                        "name": "-M --members",
                        "lines": 2,
                        "flag": "-M",
                        "long": "--members"
                    }
                ]
            },
            {
                "name": "CAVEATS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "CONFIGURATION",
                "lines": 2,
                "subsections": [
                    {
                        "name": "ENCRYPT___METHOD (string)",
                        "lines": 11
                    },
                    {
                        "name": "MAX___MEMBERS___PER___GROUP (number)",
                        "lines": 14
                    },
                    {
                        "name": "MD5___CRYPT___ENAB (boolean)",
                        "lines": 15
                    },
                    {
                        "name": "SHA___CRYPT___MIN___ROUNDS (number), SHA___CRYPT___MAX___ROUNDS (number)",
                        "lines": 20
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "gpasswd - administer /etc/group and /etc/gshadow\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "gpasswd [option] group\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The gpasswd command is used to administer /etc/group, and /etc/gshadow. Every group can have\nadministrators, members and a password.\n\nSystem administrators can use the -A option to define group administrator(s) and the -M\noption to define members. They have all rights of group administrators and members.\n\ngpasswd called by a group administrator with a group name only prompts for the new password\nof the group.\n\nIf a password is set the members can still use newgrp(1) without a password, and non-members\nmust supply the password.\n",
                "subsections": [
                    {
                        "name": "Notes about group passwords",
                        "content": "Group passwords are an inherent security problem since more than one person is permitted to\nknow the password. However, groups are a useful tool for permitting co-operation between\ndifferent users.\n"
                    }
                ]
            },
            "OPTIONS": {
                "content": "Except for the -A and -M options, the options cannot be combined.\n\nThe options which apply to the gpasswd command are:\n",
                "subsections": [
                    {
                        "name": "-a --add",
                        "content": "Add the user to the named group.\n",
                        "flag": "-a",
                        "long": "--add"
                    },
                    {
                        "name": "-d --delete",
                        "content": "Remove the user from the named group.\n",
                        "flag": "-d",
                        "long": "--delete"
                    },
                    {
                        "name": "-h --help",
                        "content": "Display help message and exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-Q --root",
                        "content": "Apply changes in the CHROOTDIR directory and use the configuration files from the\nCHROOTDIR directory.\n",
                        "flag": "-Q",
                        "long": "--root"
                    },
                    {
                        "name": "-r --remove-password",
                        "content": "Remove the password from the named group. The group password will be empty. Only group\nmembers will be allowed to use newgrp to join the named group.\n",
                        "flag": "-r",
                        "long": "--remove-password"
                    },
                    {
                        "name": "-R --restrict",
                        "content": "Restrict the access to the named group. The group password is set to \"!\". Only group\nmembers with a password will be allowed to use newgrp to join the named group.\n",
                        "flag": "-R",
                        "long": "--restrict"
                    },
                    {
                        "name": "-A --administrators",
                        "content": "Set the list of administrative users.\n",
                        "flag": "-A",
                        "long": "--administrators"
                    },
                    {
                        "name": "-M --members",
                        "content": "Set the list of group members.\n",
                        "flag": "-M",
                        "long": "--members"
                    }
                ]
            },
            "CAVEATS": {
                "content": "This tool only operates on the /etc/group and /etc/gshadow files.  Thus you cannot change any\nNIS or LDAP group. This must be performed on the corresponding server.\n",
                "subsections": []
            },
            "CONFIGURATION": {
                "content": "The following configuration variables in /etc/login.defs change the behavior of this tool:\n",
                "subsections": [
                    {
                        "name": "ENCRYPT___METHOD (string)",
                        "content": "This defines the system default encryption algorithm for encrypting passwords (if no\nalgorithm are specified on the command line).\n\nIt can take one of these values: DES (default), MD5, SHA256, SHA512.\n\nNote: this parameter overrides the MD5CRYPTENAB variable.\n\nNote: This only affect the generation of group passwords. The generation of user\npasswords is done by PAM and subject to the PAM configuration. It is recommended to set\nthis variable consistently with the PAM configuration.\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": "MD5___CRYPT___ENAB (boolean)",
                        "content": "Indicate if passwords must be encrypted using the MD5-based algorithm. If set to yes, new\npasswords will be encrypted using the MD5-based algorithm compatible with the one used by\nrecent releases of FreeBSD. It supports passwords of unlimited length and longer salt\nstrings. Set to no if you need to copy encrypted passwords to other systems which don't\nunderstand the new algorithm. Default is no.\n\nThis variable is superseded by the ENCRYPTMETHOD variable or by any command line option\nused to configure the encryption algorithm.\n\nThis variable is deprecated. You should use ENCRYPTMETHOD.\n\nNote: This only affect the generation of group passwords. The generation of user\npasswords is done by PAM and subject to the PAM configuration. It is recommended to set\nthis variable consistently with the PAM configuration.\n"
                    },
                    {
                        "name": "SHA___CRYPT___MIN___ROUNDS (number), SHA___CRYPT___MAX___ROUNDS (number)",
                        "content": "When ENCRYPTMETHOD is set to SHA256 or SHA512, this defines the number of SHA rounds\nused by the encryption algorithm by default (when the number of rounds is not specified\non the command line).\n\nWith a lot of rounds, it is more difficult to brute forcing the password. But note also\nthat more CPU resources will be needed to authenticate users.\n\nIf not specified, the libc will choose the default number of rounds (5000).\n\nThe values must be inside the 1000-999,999,999 range.\n\nIf only one of the SHACRYPTMINROUNDS or SHACRYPTMAXROUNDS values is set, then this\nvalue will be used.\n\nIf SHACRYPTMINROUNDS > SHACRYPTMAXROUNDS, the highest value will be used.\n\nNote: This only affect the generation of group passwords. The generation of user\npasswords is done by PAM and subject to the PAM configuration. It is recommended to set\nthis variable consistently with the PAM configuration.\n"
                    }
                ]
            },
            "FILES": {
                "content": "/etc/group\nGroup account information.\n\n/etc/gshadow\nSecure group account information.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "newgrp(1), groupadd(8), groupdel(8), groupmod(8), grpck(8), group(5), gshadow(5).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                   GPASSWD(1)",
                "subsections": []
            }
        }
    }
}