No, run it in a separate command.
useradd bob <other options>
passwd bob
<passwd>
Another option would be to calculate the encrypted password and feed that into the command, but I don't know if that would work. The useradd command expects a "crypt" encrypted password. Your system might use bluefish or md5 instead. I don't know if you could use one of the ssl programs instead to produce the encryption. Also, the entry in /etc/shadow may contain a salt prefix.
useradd -p <(encryption_program options tree) username
Another thing you could do is use expect to input the password entry if using a script.
You might have luck looking in an Ubuntu wiki.
|