siotp/sisr1/tp04_scripts_admin/createUsers.sh

21 lines
427 B
Bash

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