, /etc/shadow.
script ... . , , 8 , " ".
user1:abcXYZ123:16963:0:99999:7:::
user2:DEFxyz142:16963:0:99999:7:::
user3:ijkLM1564:16963:0:99999:7:::
[root@localhost ~]# cat t.txt s.txt
user1 abcXYZ123
user2 DEFxyz142
user3 ijkLM1564
user4 abcXYZ123
user5 DEFxyz142
user6 ijkLM1564
Script
file_name="t.txt"
while read user pass
do
useradd -p ${pass} ${user}
echo "Adding user "${user}" with the password "${pass}
done < $file_name
file_name="s.txt"
while read user pass
do
useradd ${user}
echo "${pass}" | passwd --stdin ${user}
echo "Adding user "${user}" with the password "${pass}
done < $file_name
, /etc/shadow
user1:abcXYZ123:16963:0:99999:7:::
user2:DEFxyz142:16963:0:99999:7:::
user3:ijkLM1564:16963:0:99999:7:::
user4:$1$NpazYQAn$tlhfQLlP0CaFiUeNeK8HW.:16963:0:99999:7:::
user5:$1$4z8G4gvh$v0jzcV5xbhWixU1LG9mwW.:16963:0:99999:7:::
user6:$1$cBkcYJkJ$7A.j6E3gy/umUcVmY0tgt0:16963:0:99999:7:::
, , , . Ubuntu . stdin Rhel.
useradd ${user}
echo "${pass}" | passwd --stdin ${user}
, mkpasswd .
useradd -p $(mkpasswd ${pass}) ${user}
Ubuntu Passwd stdin
echo ${user}:${pass} | /usr/sbin/chpasswd