diff --git a/sisr1/tp04_scripts_admin/createUsers.sh b/sisr1/tp04_scripts_admin/createUsers.sh new file mode 100644 index 0000000..6296f82 --- /dev/null +++ b/sisr1/tp04_scripts_admin/createUsers.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +file='./logins.csv' + +while read line +do + + username=$(echo $line | cut -d ";" -f1) + # créer l'utilisateur + # option -m créer le répertoire courant dans /home et -s indique le shell + useradd -m -s "/bin/bash" $username + + group=$(echo $line | cut -d ";" -f5) + # ajout l'utilisateur à son groupe + 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 + +done < $file \ No newline at end of file diff --git a/sisr1/tp04_scripts_admin/gitpush.sh b/sisr1/tp04_scripts_admin/gitpush.sh index b82d346..aad5616 100644 --- a/sisr1/tp04_scripts_admin/gitpush.sh +++ b/sisr1/tp04_scripts_admin/gitpush.sh @@ -3,7 +3,7 @@ if [ -z "$1" ] ; then read -p "Erreur: Ecrivez un message " $message else - message=$1 + message="$1" fi # Ajout des fichiers modifiers