correction script
This commit is contained in:
20
sisr1/tp04_scripts_admin/createUsers.sh
Normal file
20
sisr1/tp04_scripts_admin/createUsers.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
fichier='./login.csv'
|
||||
|
||||
while read line
|
||||
do
|
||||
|
||||
|
||||
username=$(echo $line | cut -d ";" -f1)
|
||||
useradd -m -s "/bin/bash" $username
|
||||
|
||||
# permet l'ajout d'un utilisateur
|
||||
group=$(echo $line | cut -d ";" -f5)
|
||||
usermod -ag $group $username
|
||||
|
||||
password=$(echo $line | cut -d ";" -f2)
|
||||
#permet de changer le mot de passe
|
||||
echo $username:$password | chpasswd
|
||||
|
||||
chown $username:$username /home/$username
|
Reference in New Issue
Block a user