2025-03-14 21:59:59 -06:00
|
|
|
# chpasswd
|
|
|
|
|
|
|
|
|
|
> Change the passwords for multiple users by using `stdin`.
|
2025-12-16 10:20:31 -07:00
|
|
|
> See also: `passwd`.
|
2025-03-14 21:59:59 -06:00
|
|
|
> More information: <https://manned.org/chpasswd.8>.
|
|
|
|
|
|
|
|
|
|
- Change the password for a specific user:
|
|
|
|
|
|
|
|
|
|
`printf "{{username}}:{{new_password}}" | sudo chpasswd`
|
|
|
|
|
|
|
|
|
|
- Change the passwords for multiple users (The input text must not contain any spaces.):
|
|
|
|
|
|
|
|
|
|
`printf "{{username_1}}:{{new_password_1}}\n{{username_2}}:{{new_password_2}}" | sudo chpasswd`
|
|
|
|
|
|
|
|
|
|
- Change the password for a specific user, and specify it in encrypted form:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`printf "{{username}}:{{new_encrypted_password}}" | sudo chpasswd {{[-e|--encrypted]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Change the password for a specific user, and use a specific encryption for the stored password:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`printf "{{username}}:{{new_password}}" | sudo chpasswd {{[-c|--crypt-method]}} {{NONE|DES|MD5|SHA256|SHA512}}`
|