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

Comments

Popular posts from this blog

Logical volume vmxxxx_img is used by another device - Error on LVM removal

Open VZ cheat Sheet

Cheat sheet for Hardware RAID health check - Megaraid, Adaptec, 3wareraid and HPraid.