chpasswd
batch update user passwords
TLDR
Change the password for a specific user
SYNOPSIS
chpasswd [options]
DESCRIPTION
chpasswd reads username:password pairs from standard input and updates user passwords in batch. This is useful for system administration tasks requiring password changes for multiple users at once, such as during initial account provisioning or automated password rotation.
Input format is one user per line as username:password with no spaces around the colon. Passwords are encrypted using the system default method (typically SHA-512) unless a different method is specified. Pre-encrypted passwords can also be supplied with the -e flag.
PARAMETERS
-e, --encrypted
Passwords are supplied in encrypted form-c, --crypt-method method
Specify encryption method (NONE, DES, MD5, SHA256, SHA512)-m, --md5
Use MD5 encryption-s, --sha-rounds rounds
Number of rounds for SHA encryption
CONFIGURATION
/etc/login.defs
Controls default encryption method (ENCRYPTMETHOD), SHA rounds (SHACRYPTMINROUNDS, SHACRYPTMAX_ROUNDS), and other password policy settings used by chpasswd.
CAVEATS
Requires root privileges. Passwords passed via command line may be visible in process listings. Consider using encrypted passwords or secure input methods in scripts. DES encryption is considered weak.
