When automating various deployment or bootstrapping processes, it is handy to be able to set a user’s password from the command-line or from a shellscript. Typically, this is done immediately after user creation.
This is an easy way of doing it:
echo username:secret | chpasswd
Of course, the regular security warnings apply: the password will be in the shell history, password will be visible in the process list, etc. so think before using.