siotp/sio2/SISR/Python/creatusr
2023-10-09 17:11:49 +02:00

20 lines
448 B
Python
Executable File

#!/usr/bin/python3
try:
fh = open("user.txt", "r")
except:
print ("Fichier user.txt inconnu")
else:
line = fh.readline ()
while line:
# use realine() to read next line
maligne = line.rstrip()
(login,complet)=maligne.split(":")
print(login , complet)
cmd = "useradd -m -c \""+ complet + "\" " + login + "-s /bin/bash/ "+login
print (cmd)
line = fh.readline()
fh.close()