Création des utilisateurs sur redhat 7
Bonsoir svp je voulais savoir comment crée en même temps plusieurs utilisateurs avec un même mot de passe
Sans passer par useradd à chaque fois,
Merci cordialement
Sans passer par useradd à chaque fois,
Merci cordialement
1 réponse
-
ContributeurSalut,
Avec une boucle ?
-
-
Contributeur@lemankreoLe contenu du fichier avec les noms
$ cat fich
toto
tata
titi
tutu
tete
tyty
Les utilisateurs du système ayant un shell$ grep '/bin/[b]*[a]*sh$' /etc/passwd
root:x:0:0:root:/root:/bin/bash
jp:x:1000:1000:jp,,,:/home/jp:/bin/bash
La boucle à utiliser$ while read ligne; do useradd -p blabla "${ligne}"; done <fich
Les utilisateurs du système ayant un shell$ grep '/bin/[b]*[a]*sh$' /etc/passwd
root:x:0:0:root:/root:/bin/bash
jp:x:1000:1000:jp,,,:/home/jp:/bin/bash
toto:x:1001:1001::/home/toto:/bin/sh
tata:x:1002:1002::/home/tata:/bin/sh
titi:x:1003:1003::/home/titi:/bin/sh
tutu:x:1004:1004::/home/tutu:/bin/sh
tete:x:1005:1005::/home/tete:/bin/sh
tyty:x:1006:1006::/home/tyty:/bin/sh
-