CHGPASSWD(8)
๐ chgpasswd โ the chgpasswd(8) glow-up ๐
okay bestie, so this is chgpasswd from the System Management Commands girlies. it lives in the shadow-utils 4.20.0 era (dated 07/30/2026, iconic) and it's the batch-mode group-password updater. let's get into it ๐ซถ
โจ NAME โจ
chgpasswd โ update group passwords in batch mode. yes, batch. not one at a time. we're efficient here ๐
๐ธ SYNOPSIS ๐ธ
chgpasswd [options]
๐ฆ DESCRIPTION ๐ฆ
okay so here's the vibe. chgpasswd reads a whole lil list of group name + password pairs from standard input, and uses that info to update a bunch of already existing groups. she does not create groups. she updates the ones you already have, bestie. ๐
every line has to be in this exact format:
group_name:password
by default, the password you hand over has to be in clear-text, and chgpasswd is the one who encrypts it for you. no cap. ๐ฅ
the default encryption algorithm can be set system-wide with the ENCRYPT_METHOD variable in /etc/login.defs, and you can also override it with the -e or -c options. so many layers, so much control.
this command is intended to be used in a large system environment where many accounts get created all at once. like, imagine onboarding a whole company in one afternoon. that's her moment. main character energy. ๐
โญ OPTIONS โญ
the options that apply to chgpasswd are, in order, no skipping:
-c,--crypt-methodโ use the specified method to encrypt the passwords.
the available methods are SHA256, SHA512, YESCRYPT and NONE, if your libc supports these methods. (that "if" is doing a lot of heavy lifting, so check your libc, bestie.)
-e,--encryptedโ the passwords you supply are already in encrypted form. so she won't encrypt them again. she trusts you. ๐-h,--helpโ display help message and exit. your lil emergency exit. ๐ช-R,--rootCHROOT_DIR โ apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory. only absolute paths are supported. no SELINUX support.-s,--sha-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 ๐
okay listen up, this is the serious part and i need you locked in ๐
- remember to set permissions or
umaskto prevent readability of unencrypted files by other users. like, actually do it. don't leave your clear-text passwords out for the whole group chat to see. ๐ญ - you should make sure the passwords and the encryption method respect the system's password policy.
๐ CONFIGURATION ๐
the following configuration variables in /etc/login.defs change the behavior of this tool. she reads her settings from there, and these are the knobs:
ENCRYPT_METHOD (string)
this defines the system default encryption algorithm for encrypting passwords (if no algorithm is specified on the command line).
it can take one of these values: SHA256, SHA512 (default), YESCRYPT. see crypt(5) for recommendations.
Note: this only affects the generation of group passwords. the generation of user passwords is done by PAM and subject to the PAM configuration. it is recommended to set this variable consistently with the PAM configuration. consistency is the whole vibe, fr fr.
History: this variable is used by other programs, which may still default to unsafe algorithms such as DES. to avoid using unsafe algorithms, the variable should always be specified. always. no exceptions. ๐
MAX_MEMBERS_PER_GROUP (number)
maximum members per group entry. when the maximum is reached, a new group entry (line) is started in /etc/group (with the same name, same password, and same GID).
the default value is 0, meaning that there are no limits in the number of members in a group.
this feature (split group) permits to limit the length of lines in the group file. this is useful to make sure that lines for NIS groups are not larger than 1024 characters.
if you need to enforce such limit, you can use 25.
Note: split groups may not be supported by all tools (even in the Shadow toolsuite). you should not use this variable unless you really need it. like, really really. ๐
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 used by the encryption algorithm by default (when the number of rounds is not specified on the command line).
with a lot of rounds, it is more difficult to brute force the password. but note also that more CPU resources will be needed to authenticate users. it's giving tradeoff. โ๏ธ
if not specified, the libc will choose the default number of rounds (5000), which is orders of magnitude too low for modern hardware. ๐ฌ
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 this value will be used.
if SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value will be used.
Note: this only affect the generation of group passwords. the generation of user passwords is done by PAM and subject to the PAM configuration. it is 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 used by the encryption algorithm by default (when the cost factor is not specified on the command line).
with a high cost factor, it is more difficult to brute force the password. but note also that more CPU resources will be needed to authenticate users.
the value must be inside the 1-11 range.
Note: this only affect the generation of group passwords. the generation of user passwords is done by PAM and subject to the PAM configuration. it is recommended to set this variable consistently with the PAM configuration.
๐ FILES ๐
the lil squad of files she cares about:
/etc/groupโ group account information./etc/gshadowโ secure group account information./etc/login.defsโ shadow password suite configuration.
๐ SEE ALSO ๐
go read these next, bestie, they're all connected:
and that's the whole page, no crumbs left ๐ shoutout to shadow-utils 4.20.0, dated 07/30/2026 โ go encrypt responsibly, set your umask, and remember: clear-text passwords never leave the group chat. periodt. ๐โจ
๐ฆ 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