for names in user1 user2 user3 user4 user5
do
useradd $names
echo "anypassword" | passwd --stdin $names
done
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
user1
user2
user3
etc
for names in `cat users.txt`
do
echo $names
useradd $names
done
If you want to add usernames and passwords from a list, then make a text file like so
user1:password1
user2:password2
user3:password3
etc
save the file , in this example we'll save it as userlist.txt
then
for names in `cat userlist.txt`
do
user=`echo $names | cut -f1 -d:`
pwd=`echo $names | cut -f2 -d:`
useradd $user
echo $pwd | passwd --stdin $user
done