[CentOS] [OT]: Passing password for a command on the fly

Fri May 16 08:38:17 UTC 2008
Mário Gamito <gamito at gmail.com>


First things first, sorry for the off-topic, but I've already burned
my eyes Googling and couldn't find the answer to what I need and I
remembered asking here, because I'm a long time CentOS and its mailing
list user.
Again, my apologies.

I have this command to create an FTP account:

# pure-pw useradd mario -u 502 -g 502 -n 1000 -N 200 -d /home/pages/mario

This command asks for the password twice.

I need to pass the password (preferably without expect) so I can
create the account without prompting.

If i run:

# echo secret | pure-pw useradd mario -u 502 -g 502 -n 1000 -N 200 -d

It reads the first insertion, but asks for the second.

I knew how to do this a long time ago, but I've forgotten and couldn't
find anything useful on Google.

Any help would be appreciated.

Warm Regards,
Mário Gamito