CHPASSWD(8)
๐ CHPASSWD โ the batch password glow-up ๐
okay bestie, so this is chpasswd from the System Management Commands section (that's section 8, for the admins ๐ซถ). it's the tool you call when you need to update a whole group of existing users' passwords in one go, no cap.
โจ SYNOPSIS โจ
chpasswd [options]
๐ธ DESCRIPTION ๐ธ
so here's the vibe: chpasswd reads a list of user name + password pairs from standard input, and uses that tea โ to update a bunch of existing users at once. every single line has to look like this:
user_name:password
by default, the passwords you feed it have to be in clear-text, and chpasswd does the encrypting for you. also, the password age gets updated too, if it's present. periodt.
by default, passwords get encrypted by PAM, but โ and listen, this is not recommended โ you can pick a different encryption method with the -e or -c options.
here's the important part tho ๐ โ except when PAM is doing the encrypting, chpasswd first updates all the passwords in memory, and then commits all the changes to disk only if no errors happened for any user. all or nothing, iconic behavior fr fr.
but when PAM is the one encrypting the passwords (and updating them in the system database), then if a password can't be updated, chpasswd just keeps going and updates the next users, and it'll return an error code on exit. messy but functional ๐
this command is made for big system environments where you're creating a ton of accounts all at once. it's giving "I have 4,000 interns and one afternoon" energy.
๐ OPTIONS ๐
the options that apply to the chpasswd command are:
-c,--crypt-method METHODโ use the method you specify to encrypt the passwords.
the available methods are SHA256, SHA512, YESCRYPT and NONE, if your libc supports them.
by default, PAM is used to encrypt the passwords.
-e,--encryptedโ the passwords you supplied are already in encrypted form.-h,--helpโ show the help message and dip out.-R,--root CHROOT_DIRโ apply changes in theCHROOT_DIRdirectory and use the configuration files from theCHROOT_DIRdirectory. only absolute paths are supported. no SELINUX support.-P,--prefix PREFIX_DIRโ apply changes to configuration files under the root filesystem found under the directoryPREFIX_DIR. this option does not chroot, and it's meant for preparing a cross-compilation target. some limitations, bestie, listen up: NIS and LDAP users/groups are not verified. PAM authentication is using the host files. No SELINUX support.-s,--sha-rounds ROUNDSโ use the specified number of rounds to encrypt the passwords.
you can only use this option with crypt method: SHA256 SHA512 YESCRYPT
by default, the number of rounds for SHA256 or SHA512 is defined by the SHA_CRYPT_MIN_ROUNDS and SHA_CRYPT_MAX_ROUNDS variables in /etc/login.defs.
a minimal value of 1000 and a maximal value of 999,999,999 will be enforced for SHA256 and SHA512. the default number of rounds is 5000.
by default, the number of rounds for YESCRYPT is defined by the YESCRYPT_COST_FACTOR in /etc/login.defs.
a minimal value of 1 and a maximal value of 11 will be enforced for YESCRYPT. the default number of rounds is 5.
๐จ CAVEATS ๐จ
remember to set permissions or umask so that other users can't read your unencrypted files. please please please, bestie, do not leave your plaintext passwords just vibing out in the open where anybody can read them ๐ญ lock it down.
๐ CONFIGURATION ๐
these configuration variables in /etc/login.defs change how this tool behaves:
SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
when ENCRYPT_METHOD is set to SHA256 or SHA512, this defines the number of SHA rounds the encryption algorithm uses by default โ like, when the number of rounds isn't specified on the command line.
with a lot of rounds, it's harder to brute force the password. but also note that more CPU resources will be needed to authenticate users. tradeoffs, we love them ๐
if it's not specified, the libc will choose the default number of rounds (5000), which is orders of magnitude too low for modern hardware. yeah. yikes.
the values must be inside the 1000-999,999,999 range.
if only one of the SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS values is set, then that value will be used.
if SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value will be used.
note: this only affects the generation of group passwords. the generation of user passwords is done by PAM and is subject to the PAM configuration. it's recommended to set this variable consistently with the PAM configuration.
YESCRYPT_COST_FACTOR (number)
when ENCRYPT_METHOD is set to YESCRYPT, this defines the cost factor the encryption algorithm uses by default โ when the cost factor isn't specified on the command line, that is.
with a high cost factor, it's harder to brute force the password. but also note that more CPU resources will be needed to authenticate users. same energy as above โจ
the value must be inside the 1-11 range.
note: this only affects the generation of group passwords. the generation of user passwords is done by PAM and is subject to the PAM configuration. it's recommended to set this variable consistently with the PAM configuration.
๐ FILES ๐
/etc/passwdโ user account information./etc/shadowโ secure user account information./etc/login.defsโ shadow password suite configuration./etc/pam.d/chpasswdโ PAM configuration forchpasswd.
๐ SEE ALSO ๐
passwd(1), newusers(8), login.defs(5), useradd(8).
and that's the whole page, bestie ๐ฆ go forth and batch-update responsibly. this little masterpiece is from shadow-utils 4.20.0, dated 07/30/2026. slay, stay encrypted, and never ever leave plaintext passwords lying around ๐โจ๐
๐ฆ where this page comes from
- arch rolling: shadow 4.20.0.arch1-1 ยท 0BSD AND BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms