chpasswd
Quick Reference
Command Name:
chpasswd
Category:
user management
Platform:
Linux
Basic Usage:
Common Use Cases
- 1
Batch password management
Change passwords for multiple users at once
- 2
System administration
Manage user passwords in bulk operations
- 3
User provisioning
Set initial passwords for new user accounts
- 4
Password synchronization
Synchronize passwords across multiple systems
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:
echo "user1:newpassword1
echo "user1:newpassword1" | sudo chpasswd -e
echo "user1:newpassword1" | sudo chpasswd -c SHA512
sudo chpasswd < user_passwords.txt