chpasswd
Quick Reference
Command Name:
chpasswd
Category:
user management
Platform:
Linux
Basic Usage:
Common Use Cases
Syntax
chpasswd [options]
Options
Option | Description |
---|---|
-c, --crypt-method METHOD |
Use the specified method to encrypt the passwords (DES, MD5, NONE, SHA256, SHA512) |
-e, --encrypted |
Supplied passwords are already encrypted |
-m, --md5 |
Use MD5 encryption instead of DES |
-R, --root CHROOT_DIR |
Directory to chroot into |
-s, --sha-rounds ROUNDS |
Number of SHA rounds for the SHA256/SHA512 crypt algorithms |
-h, --help |
Display help message and exit |
Examples
How to Use These Examples
The examples below show common ways to use the chpasswd
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Change passwords for multiple users using a file echo "user1:newpassword1 user2:newpassword2 user3:newpassword3" | sudo chpasswd
Advanced Examples:
# Change password for a single user with MD5 encryption echo "user1:newpassword1" | sudo chpasswd -m
cat /path/to/userlist.txt | sudo chpasswd