26 lines
405 B
Bash
26 lines
405 B
Bash
!/bin/bash
|
|
|
|
while read line
|
|
do
|
|
|
|
echo $line > ./temptp4
|
|
group=$(cut -d "," -f 5 ./temptp4)
|
|
user=$(cut -d "," -f 1 ./temptp4)
|
|
mdp=$(cut -d "," -f 2 ./temptp4)
|
|
|
|
if grep -q $group /etc/group ; then
|
|
echo "ok"
|
|
else
|
|
groupadd $group
|
|
fi
|
|
|
|
useradd $user --create-home --groups $group --shell /bin/bash
|
|
chown $user /home/$user
|
|
|
|
(echo $mdp ; echo $mdp) | passwd $user
|
|
|
|
done < logins.csv
|
|
rm ./temptp4
|
|
|
|
|