Try something like this (untested)

cat <filename> | awk '{printf("-p %s %s\n",$2,$1)}' | xargs useradd

or you could try this:

cat <filename> | awk '{printf("useradd -M -p %s %s\n",$2,$1)}' > myfile
chmod 777 myfile
myfile


HTH, HAND
Bill Ward

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 28, 1999 3:18 PM
To: [EMAIL PROTECTED]
Cc: recipient.list.not.shown; @nswcphdn.navy.mil
Subject: script to buld add user accounts


I run a small mail server for some schools that cannot afford their own and 
from time to time I get a list of new users who need accounts.  I would like

to automate this as much as possible on my box running RH 6.1.

I was wondering if anyone knew of a script that would take a text file with 
something like:
    name1 pass1
    name2 pass2
    ...     ...
as a format and then just go through the list and run adduser against is
with 
the proper tags?  I am not much of a shell script hacker, and I have tried 
modifying a PERL script that I have just to crypt a list of 
username/passwords, but I am failing there as well.

Any help would be much appreciated.  I volunteer my time and when I get 50+ 
names at a time it is a big time commitment, as I get the account request in

the form of a spreadsheet it would be nice if I could put it to use.  Thanks

in advance.

Cheers,

Jack.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to