chpasswd Command Examples

Change the passwords for multiple users by using stdin. More information: https://manned.org/chpasswd.8.

printf "{{username}}:{{new_password}}" | sudo chpasswd

printf "{{username_1}}:{{new_password_1}}\n{{username_2}}:{{new_password_2}}" | sudo chpasswd

printf "{{username}}:{{new_encrypted_password}}" | sudo chpasswd --encrypted

printf "{{username}}:{{new_password}}" | sudo chpasswd --crypt-method {{NONE|DES|MD5|SHA256|SHA512}}