To create multiple users
Add a new group according to your Requirement.
#groupadd tacusers
now , open editor for script
#vim username.sh
srno=1
echo "Sno. ......................... Name............................. " cat >users
echo "#########################################" cat >>users
for mxx in `cat userdetail`
do
mx3=`echo $mxx cut -d "" -s -f1`
mx1=`echo $mxx cut -d "" -s -f1`
mx2=`echo $mx3 sed "s/-/ /g"`
echo "$srno $mx2 $mx1"
echo "$srno $mx3 $mx1 " awk `{printf "%-3d %-35s \n" , $1, $2, $3 }` cat >>users
/usr/sbin/useradd -m -g 506 -c "$mx2" -d /home/tac_users/$mx1 -s /bin/bash "$mx1"
echo " passwd $mx1"
echo $mx1 passwd --stdin $mx1
srno=`expr $srno + 1`
done
echo "###################################" cat >>users
echo "###################################" cat>> users
:wq!
****Now create file to add users**************
cat userdetail
DHQ,Dehradunukdehadmin
THQ,Rishikeshukrisadmin
BHQ,Raipurukraiadmin
THQ,Vikasnagarukvikadmin
BHQ,Doiwalaukdoiadmin
add many user detail line as you want and by running script username and passwd will be created on your machine , whose username are given in file userdetail and password will be username.
eg for ukdehadmin username : passwd will be ukdehadmin ....
enjoy.......