Create Multiple User From file

Take Following steps:-
1. Create a user list File ( Example:- userlist )

 

jon1
jon2
jon3
jon4
jon5
jon6
.
.
.

2. Write a script file and call this list ( Example :- user.sh )
#!/bin/bash
NEW_USERS=/PathOf/userlist
cat ${NEW_USERS} | while read USER
do
useradd $USER
echo “jon@123” | passwd  “$USER” –stdin #This will set common password to all user
done

or use Single script

——————————-
#!/bin/bash
for ((i=100;i<=108;i++)) ;
do
useradd eric$i
echo “eric$i” | passwd  “eric$i” –stdin #This will set common password to all user
done
——————————-

you can change eric  with any user name.  :)

Leave a Reply

Your email address will not be published. Required fields are marked *