Change the password for a specific user, and specify it in encrypted form

chpasswd

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

click the source code to copy install chpasswd on any operating system with command-not-found.com