hi,
you can try with the follwing two scripts...
getlist.sh will get the list of users from the given file
#start getlist.sh
#!/bin/sh
echo -e "Enter the file name of the user list"
#echo -e "\n\n\n\t\t"
read userlist
exec ./createid $(cat $userlist)
exit 0
#end getlist.sh
it will create user ids and give passwords as u specified in a simple text
file using tab or space as a separater...
#start createids
#!/bin/sh
while [ "$1" != "" ]
do
LOGIN_ID=$1
shift
Pass=$1
GRP="popusers"
#echo "" >> useradd.log
#echo -e $LOGIN_ID >> useradd.log
useradd -g $GRP -d /local/$LOGIN_ID -s /bin/bash -p $Pass $LOGIN_ID
#echo useradd -g $GRP -d /local/$LOGIN_ID -s /bin/bash -p $Pass $LOGIN_ID >>
useradd.log
echo $Pass | passwd --stdin $LOGIN_ID >> useradd.log
LOGIN_ID=
Pass=
shift
done
echo "ALL DONE!"
exit 0
#end createids
This follwing command will get the password from standard input.
echo $Pass | passwd --stdin $LOGIN_ID
I hope it will work.
P.Anandan
State Bank of Saurashtra
Bhavnagar
----- Original Message -----
From: "Sridhar R" <sridharinfinity@xxxxxxxxx>
To: "Chenna Linux User's Group" <ilugc@xxxxxxxxxxxxx>
Sent: Sunday, July 11, 2004 02:40 AM
Subject: [Ilugc] adding multiple user accounts with password
I want to add enourmous amount of users with specified passwords
automatically with script. But the problem is `passwd` command
doesn't accept passwords from non-stdin stream and `adduser` command
requires encrypte version of password if at all passed is needed to be
given.
--
Sridhar - http://www.cs.annauniv.edu/~rsridhar
Blog: http://www.livejournal.com/users/sridharinfinity