SyntaxFix
Write A Post
Hire A Developer
Questions
The following works for me and tested on Ubuntu 14.04. It is a one liner that does not require any user input.
sudo useradd -p $(openssl passwd -1 $PASS) $USERNAME
Taken from @Tralemonkey