siotp/sisr1/tp04_scripts_admin/createUsers.sh
2025-02-20 14:53:10 +01:00

14 lines
303 B
Bash

#!/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