CentOS Debian Mint openSUSE Red Hat Ubuntu

Chpasswd Command in Linux

Chpasswd Command in Linux


Creating user and managing user password is one of the basic tasks of the Linux system administrator. That’s why the chpasswd command was born.

chpasswd command is used to change the password equivalent to passwd command. But chpasswd command allows changing passwords of multiple users easily.

This article will show you how to use the chpasswd command in Linux as we go through below.

The syntax of chpasswd command

$ sudo chpasswd




Press Enter to go to the next user. Once done, press Ctrl+d to exit and the new password will be saved.

For example:

Or you can create a password file with the cat command:

$ cat > file.txt

For example:

Press Ctrl+ D to exit.

Then send this file to chpasswd command:

$ sudo chpasswd < pass.txt


  1. -e Use encrypted password

This tells chpasswd that your password is encrypted so chpasswd won’t re-encrypt it.

  1. -m , -md5 Use MD5 hash encryption
  2. -c Choose 1 encryption method

For example, I want to choose DES as the encryption method for my password:

$ sudo chpasswd -c DES
  1. -h, -help Ask for help information from the command



You’ve already gone through the details of how to use the chpasswd command in Linux.

Thanks for reading.

Similar Posts