forked from guillaume.emorine/siotp
Nouveau fichier : sisr1/scripts/createUsers.sh
This commit is contained in:
parent
6364bbb5a2
commit
4d1beb60d3
18
sisr1/scripts/createUsers.sh
Normal file
18
sisr1/scripts/createUsers.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
while read line
|
||||
do
|
||||
touch ./temptp4.txt
|
||||
file="./temptp4.txt"
|
||||
echo $line > $file
|
||||
user=$(cut -d "," -f 1 $file)
|
||||
usergroup=$(cut -d "," -f 5 $file)
|
||||
passwd=$(cut -d "," -f 2 $file)
|
||||
if ! grep -q $usergroup /etc/group ; then
|
||||
groupadd -f $usergroup
|
||||
fi
|
||||
useradd $user --create-home --groups $usergroup --shell /bin/bash
|
||||
(echo $passwd ; echo $passwd) | passwd $user
|
||||
chown -hR $user /home/$user
|
||||
rm ./temptp4.txt
|
||||
done < ./logins.csv
|
Loading…
x
Reference in New Issue
Block a user