From 05dc93b47a2b6875a336f7683c05397200235cfd Mon Sep 17 00:00:00 2001 From: "aboulai.bayo" Date: Thu, 20 Feb 2025 14:53:10 +0100 Subject: [PATCH] =?UTF-8?q?cr=C3=A9ation=20d'users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sisr1/tp04_scripts_admin/createUsers.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sisr1/tp04_scripts_admin/createUsers.sh diff --git a/sisr1/tp04_scripts_admin/createUsers.sh b/sisr1/tp04_scripts_admin/createUsers.sh new file mode 100644 index 0000000..7d7d59c --- /dev/null +++ b/sisr1/tp04_scripts_admin/createUsers.sh @@ -0,0 +1,14 @@ +#!/bin/bash +fichier=./logins.csv #le fichier +while read ligne +do +username=$(echo $ligne | cut -d ";" -f1) +useradd -m -s "/bin/bash" $username + +group=$(echo $ligne | -d ";" -f5) +usermod -aG $group $username + +echo $username:$passwd | chpasswd +chown $username:$username /home/$username + +done < $fichier \ No newline at end of file