bash - Assigning password to users created from CSV -
the script functions without error, password not work on accounts. not sure why password not beingness assigned, help awesome.
#!/bin/bash oldifs=$ifs ifs="," while read firstname lastname userid sudo useradd -c "'${firstname} ${lastname}'" -d /home/"${userid}" -s /bin/bash "${userid}" sudo usermod -p changeme123 "${userid}" sudo usermod -g pupil "${userid}" done < students.csv
i tested next line instead of usermod -p.
echo "${userid}:changeme123" | chpasswd
need piping sudo. not test @ moment. should sudo bash -c
.
bash passwords user user-accounts
No comments:
Post a Comment