user
This commit is contained in:
parent
d6d9a7480f
commit
b0a7d61dca
24
sisr1/tp04-scripts-admin/createUsers.sh
Normal file
24
sisr1/tp04-scripts-admin/createUsers.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
fichier=./logins.csv
|
||||
|
||||
|
||||
|
||||
|
||||
while read ligne
|
||||
do
|
||||
#stock le nom d'utilisateur du premier champ
|
||||
username=$(echo $ligne | cut -d ";" -f1)
|
||||
useradd -m -s "/bin/bash" $username
|
||||
|
||||
#attribution de l'utilisateur au groupe
|
||||
group=$(echo $ligne | cut -d ";" -f5)
|
||||
usermod -aG $group $username
|
||||
|
||||
#stock le mdp générer dans createLogins.sh
|
||||
passwd=$(echo $ligne | cut -d ";" -f2)
|
||||
|
||||
echo $username:$passwd | chpasswd
|
||||
|
||||
chown $username:$username /home/$username
|
||||
|
||||
done < $fichier
|
Loading…
x
Reference in New Issue
Block a user