hi: Can someone who knows shell scripting help me with this: I want to write a simple script that will add logins to my password file using these commands: o vi o while o read o echo o useradd ��etc�.. This input file called "passwordfile" has these users to be added to my password file: <Snip> UID:Name jms:John Smith poi:Peter Inkspot lkj:Linda Jones hgf:Harry Fargo nbv:Nancy Vaughn sdf:Sam Fettucini lkj:Larry Johnson <Snip> thanks __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com
you could do something like this #!/bin/bash # Script to read text file with usernames and passwords and enter them as # system users PASSFILE='passwordfile' SHELL='/bin/bash' cat $PASSFILE | while read LINE do USERNAME=`cut -f1 -d':' $LINE` FULLNAME=`cut -f2 -d':' $LINE` useradd -c $FULLNAME -s $SHELL -d /home/$USERNAME $USERNAME done Note, this doesnt add the passwords in /etc/shadow, to do that you would need some fancy perl scripts or use expect On Tuesday 27 August 2002 03:51 pm, Gelah wrote:
hi:
Can someone who knows shell scripting help me with this:
I want to write a simple script that will add logins to my password file using these commands:
o vi o while o read o echo o useradd etc ..
This input file called "passwordfile" has these users to be added to my password file:
<Snip>
UID:Name jms:John Smith poi:Peter Inkspot lkj:Linda Jones hgf:Harry Fargo nbv:Nancy Vaughn sdf:Sam Fettucini lkj:Larry Johnson
<Snip>
thanks
__________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com
-- Chad Whitten Network/Systems Administrator neXband Communications cwhitten@nexband.com
participants (2)
-
Chad Whitten
-
Gelah