×


About Chpasswd Command in Linux - An Overview ?

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.


What is the syntax of chpasswd command ?

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


chpasswd command Options

  • -c, –crypt-method Method_Name : This command option is used for the crypt method. The method can be DES, MD5, SHA256, SHA512 or NONE.
  • -e, –encrypted : It is used to supply the encrypted passwords.
  • -h, –help : Used to display the command options and messages.
  • -m, –md5 : It is used to encrypt the clear text password using the MD5 algorithm.
  • -s, –sha-no_of_rounds : Here you can give the number of rounds for the SHA crypt algorithm.


[Need help in Configuring any Software on Linux System? We can help you. ]


Conclusion

This article covers how to use the chpasswd command in Linux.