Joachim Backes wrote:
I think the problem is the password. Splitting the script in to parts:
- useradd .... $1 .......
- password --stdin <<"EOF"
$2 EOF
so if you call
script <USERNAME> "<PASSWORD>"
the password should be set correctly.
Actually, one can use the useradd command to create the user and set the password at the same time - you just have to remember to crypt() the password string before passing it to useradd.