{
    "mode": "man",
    "parameter": "chgpasswd",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/chgpasswd/8/json",
    "generated": "2026-06-16T03:24:57Z",
    "synopsis": "chgpasswd [options]",
    "sections": {
        "NAME": {
            "content": "chgpasswd - update group passwords in batch mode\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "chgpasswd [options]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The chgpasswd command reads a list of group name and password pairs from standard input and\nuses this information to update a set of existing groups. Each line is of the format:\n\ngroupname:password\n\nBy default the supplied password must be in clear-text, and is encrypted by chgpasswd.\n\nThe default encryption algorithm can be defined for the system with the ENCRYPTMETHOD\nvariable of /etc/login.defs, and can be overwritten with the -e, -m, or -c options.\n\nThis command is intended to be used in a large system environment where many accounts are\ncreated at a single time.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The options which apply to the chgpasswd command are:\n",
            "subsections": [
                {
                    "name": "-c --crypt-method",
                    "content": "Use the specified method to encrypt the passwords.\n\nThe available methods are DES, MD5, NONE, and SHA256 or SHA512 if your libc support these\nmethods.\n",
                    "flag": "-c",
                    "long": "--crypt-method"
                },
                {
                    "name": "-e --encrypted",
                    "content": "Supplied passwords are in encrypted form.\n",
                    "flag": "-e",
                    "long": "--encrypted"
                },
                {
                    "name": "-h --help",
                    "content": "Display help message and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-m --md5",
                    "content": "Use MD5 encryption instead of DES when the supplied passwords are not encrypted.\n",
                    "flag": "-m",
                    "long": "--md5"
                },
                {
                    "name": "-R --root",
                    "content": "Apply changes in the CHROOTDIR directory and use the configuration files from the\nCHROOTDIR directory.\n",
                    "flag": "-R",
                    "long": "--root"
                },
                {
                    "name": "-s --sha-rounds",
                    "content": "Use the specified number of rounds to encrypt the passwords.\n\nThe value 0 means that the system will choose the default number of rounds for the crypt\nmethod (5000).\n\nA minimal value of 1000 and a maximal value of 999,999,999 will be enforced.\n\nYou can only use this option with the SHA256 or SHA512 crypt method.\n\nBy default, the number of rounds is defined by the SHACRYPTMINROUNDS and\nSHACRYPTMAXROUNDS variables in /etc/login.defs.\n",
                    "flag": "-s",
                    "long": "--sha-rounds"
                }
            ]
        },
        "CAVEATS": {
            "content": "Remember to set permissions or umask to prevent readability of unencrypted files by other\nusers.\n\nYou should make sure the passwords and the encryption method respect the system's password\npolicy.\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\n/etc/login.defs\nShadow password suite configuration.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "gpasswd(1), groupadd(8), login.defs(5).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                 CHGPASSWD(8)",
            "subsections": []
        }
    },
    "summary": "chgpasswd - update group passwords in batch mode",
    "flags": [
        {
            "flag": "-c",
            "long": "--crypt-method",
            "arg": null,
            "description": "Use the specified method to encrypt the passwords. The available methods are DES, MD5, NONE, and SHA256 or SHA512 if your libc support these methods."
        },
        {
            "flag": "-e",
            "long": "--encrypted",
            "arg": null,
            "description": "Supplied passwords are in encrypted form."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help message and exit."
        },
        {
            "flag": "-m",
            "long": "--md5",
            "arg": null,
            "description": "Use MD5 encryption instead of DES when the supplied passwords are not encrypted."
        },
        {
            "flag": "-R",
            "long": "--root",
            "arg": null,
            "description": "Apply changes in the CHROOTDIR directory and use the configuration files from the CHROOTDIR directory."
        },
        {
            "flag": "-s",
            "long": "--sha-rounds",
            "arg": null,
            "description": "Use the specified number of rounds to encrypt the passwords. The value 0 means that the system will choose the default number of rounds for the crypt method (5000). A minimal value of 1000 and a maximal value of 999,999,999 will be enforced. You can only use this option with the SHA256 or SHA512 crypt method. By default, the number of rounds is defined by the SHACRYPTMINROUNDS and SHACRYPTMAXROUNDS variables in /etc/login.defs."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "gpasswd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/gpasswd/1/json"
        },
        {
            "name": "groupadd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/groupadd/8/json"
        },
        {
            "name": "login.defs",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/login.defs/5/json"
        }
    ]
}