echo "anypassword" | passwd --stdin $names
or you can type it all in one line and hit enter like so
for names in user1 user2 user3 user4 user5;do useradd $names;echo "anypassword" |passwd --stdin $names;done
the above will add user1 , user2 ,user3, user4 and user5 to your system.
All users will have the password "their user name followed by anypassword"
You could have your list of users in a text file and enter the commands like so, presuming your text file is called users.txt and in your text file you just insert the user names underneath one another eg
for names in `cat users.txt`
If you want to add usernames and passwords from a list, then make a text file like so
save the file , in this example we'll save it as userlist.txt
for names in `cat userlist.txt`
user=`echo $names | cut -f1 -d:`
pwd=`echo $names | cut -f2 -d:`
echo $pwd | passwd --stdin $user