{
    "content": [
        {
            "type": "text",
            "text": "# CHPASSWD (man)\n\n## NAME\n\nchpasswd - update passwords in batch mode\n\n## SYNOPSIS\n\nchpasswd [options]\n\n## DESCRIPTION\n\nThe chpasswd command reads a list of user name and password pairs from standard input and\nuses this information to update a group of existing users. Each line is of the format:\n\n## TLDR\n\n> Change the passwords for multiple users by using `stdin`.\n\n- Change the password for a specific user:\n  `printf \"{{username}}:{{new_password}}\" | sudo chpasswd`\n- Change the passwords for multiple users (The input text must not contain any spaces.):\n  `printf \"{{username_1}}:{{new_password_1}}\\n{{username_2}}:{{new_password_2}}\" | sudo chpasswd`\n- Change the password for a specific user, and specify it in encrypted form:\n  `printf \"{{username}}:{{new_encrypted_password}}\" | sudo chpasswd {{-e|--encrypted}}`\n- Change the password for a specific user, and use a specific encryption for the stored password:\n  `printf \"{{username}}:{{new_password}}\" | sudo chpasswd {{-c|--crypt-method}} {{NONE|DES|MD5|SHA256|SHA512}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (6 subsections)\n- **CAVEATS**\n- **CONFIGURATION** (1 subsections)\n- **FILES**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CHPASSWD",
        "section": "",
        "mode": "man",
        "summary": "chpasswd - update passwords in batch mode",
        "synopsis": "chpasswd [options]",
        "tldr_summary": "Change the passwords for multiple users by using `stdin`.",
        "tldr_examples": [
            {
                "description": "Change the password for a specific user",
                "command": "printf \"{{username}}:{{new_password}}\" | sudo chpasswd"
            },
            {
                "description": "Change the passwords for multiple users (The input text must not contain any spaces.)",
                "command": "printf \"{{username_1}}:{{new_password_1}}\\n{{username_2}}:{{new_password_2}}\" | sudo chpasswd"
            },
            {
                "description": "Change the password for a specific user, and specify it in encrypted form",
                "command": "printf \"{{username}}:{{new_encrypted_password}}\" | sudo chpasswd {{-e|--encrypted}}"
            },
            {
                "description": "Change the password for a specific user, and use a specific encryption for the stored password",
                "command": "printf \"{{username}}:{{new_password}}\" | sudo chpasswd {{-c|--crypt-method}} {{NONE|DES|MD5|SHA256|SHA512}}"
            }
        ],
        "tldr_source": "official",
        "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. By default, PAM is used to encrypt the passwords."
            },
            {
                "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": "passwd",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/passwd/1/json"
            },
            {
                "name": "newusers",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/newusers/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"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 21,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "-c --crypt-method",
                        "lines": 7,
                        "flag": "-c",
                        "long": "--crypt-method"
                    },
                    {
                        "name": "-e --encrypted",
                        "lines": 2,
                        "flag": "-e",
                        "long": "--encrypted"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-m --md5",
                        "lines": 2,
                        "flag": "-m",
                        "long": "--md5"
                    },
                    {
                        "name": "-R --root",
                        "lines": 3,
                        "flag": "-R",
                        "long": "--root"
                    },
                    {
                        "name": "-s --sha-rounds",
                        "lines": 12,
                        "flag": "-s",
                        "long": "--sha-rounds"
                    }
                ]
            },
            {
                "name": "CAVEATS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "CONFIGURATION",
                "lines": 2,
                "subsections": [
                    {
                        "name": "SHA___CRYPT___MIN___ROUNDS (number), SHA___CRYPT___MAX___ROUNDS (number)",
                        "lines": 20
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "chpasswd - update passwords in batch mode\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "chpasswd [options]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The chpasswd command reads a list of user name and password pairs from standard input and\nuses this information to update a group of existing users. Each line is of the format:\n\nusername:password\n\nBy default the passwords must be supplied in clear-text, and are encrypted by chpasswd. Also\nthe password age will be updated, if present.\n\nBy default, passwords are encrypted by PAM, but (even if not recommended) you can select a\ndifferent encryption method with the -e, -m, or -c options.\n\nExcept when PAM is used to encrypt the passwords, chpasswd first updates all the passwords in\nmemory, and then commits all the changes to disk if no errors occurred for any user.\n\nWhen PAM is used to encrypt the passwords (and update the passwords in the system database)\nthen if a password cannot be updated chpasswd continues updating the passwords of the next\nusers, and will return an error code on exit.\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 chpasswd 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\nBy default, PAM is used to encrypt the passwords.\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",
                "subsections": []
            },
            "CONFIGURATION": {
                "content": "The following configuration variables in /etc/login.defs change the behavior of this tool:\n",
                "subsections": [
                    {
                        "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/passwd\nUser account information.\n\n/etc/shadow\nSecure user account information.\n\n/etc/login.defs\nShadow password suite configuration.\n\n/etc/pam.d/chpasswd\nPAM configuration for chpasswd.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "passwd(1), newusers(8), login.defs(5), useradd(8).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                  CHPASSWD(8)",
                "subsections": []
            }
        }
    }
}