TP python
This commit is contained in:
19
sio2/SISR/Python/creatusr
Executable file
19
sio2/SISR/Python/creatusr
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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()
|
||||
|
Reference in New Issue
Block a user