While creating a bash script to automate the configuration of a vhost and wordpress installation, I needed to automatically create an ubuntu user and assign the password from within the script without ANY user interaction.
I tried many different methods to no avail; The only solution that worked for me was piping username:password into chpasswd:
- echo “$usrn:$usrpwd” | chpasswd
source: http://www.ibm.com/developerworks/aix/library/au-chpasspwgen.html
If this article has been helpful, please consider linking to it or commenting.
nice article, simple and work for me. Thanks ..