Ajouter createUsers.sh
This commit is contained in:
parent
b72178ba78
commit
ef58899c8e
25
createUsers.sh
Normal file
25
createUsers.sh
Normal file
@ -0,0 +1,25 @@
|
||||
!/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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user