Creating user and managing user password is one of the basic tasks of the Linux system administrator. That's why the chpasswd command originated.
chpasswd command is used to change the password equivalent to "passwd" command. But chpasswd command allows changing passwords of multiple users easily.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux Systems queries.
In this context, we shall look into how to use the chpasswd command in Linux.
chpasswd command reads a number of username and password which are separated by colon using standard input or file, and then encrypt as per the options:
$ sudo chpasswd
user1:password
user2:password
user3:password
You can Press Enter to go to the next user. Once done, press Ctrl+d to exit and the new password will be saved.
Or you can create a password file with the cat command:
$ cat > file.txt
Press Ctrl+ D to exit.
Then send this file to chpasswd command:
$ sudo chpasswd < pass.txt
This article covers how to use the chpasswd command in Linux.