useradd shell script - bulk read username and password from file.
# Author : Jaison
#Purpose : Add user and set their password from the text file all.txt
file_name="all.txt"
while read user pass
do
#useradd ${user} -p ${pass}
useradd ${user}
echo "${pass}" | passwd --stdin ${user}
echo "Adding user "${user}" with the password "${pass}
done < $file_name
#Purpose : Add user and set their password from the text file all.txt
file_name="all.txt"
while read user pass
do
#useradd ${user} -p ${pass}
useradd ${user}
echo "${pass}" | passwd --stdin ${user}
echo "Adding user "${user}" with the password "${pass}
done < $file_name
Comments
Post a Comment