useradd

David Sinck sinck@ugive.com
Thu, 20 Jul 2000 13:30:46 -0700 (MST)


\_ Ya, I'm on as root.  Look at man useradd.  It tells me that -p needs to be
\_ in the crypto format.  I wish it would let me use plain text..

Hmmm, this seems like a call for the standard sys admin response.

<click>

Oh, wait, I can't hang up the phone in email.  :-)

Use the other standard sys admin response: perl.

Assuming you have a file of user:clear-pass thusly:

foo% cat > pass
this:that
the:other
linux:password
^D
foo% perl -ne 's/(.*):(.*)/print "useradd $1 -p " . crypt($2, $1)  . "\n"/e'  pass
useradd this -p thG9iz7dzFlnw
useradd the -p th28nJZrHWOZA
useradd linux -p liD9qG.4Rmvo2
foo%

So...you can either pipe that to sh, redir to file then bash it,
change 'print' to 'system', or wait for a more palatable option to
present itself.

:-)

HTH.  HAND.

David

ps: I originally used 'sh' on the file, but it seemed to have a more
negative connotation that just 'bash'ing the file.