23 lines
483 B
Python
23 lines
483 B
Python
#!/usr/bin/python3
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
filename = "users.txt"
|
|
|
|
try:
|
|
fh = open(filename, "r")
|
|
except:
|
|
print ("Fichier ", filename, " inconnu")
|
|
else:
|
|
line = fh.readline ()
|
|
while line:
|
|
# use realine() to read next line
|
|
maligne = line.rstrip()
|
|
(login, name) = maligne.split(":")
|
|
uncmds = ["userdel", "-r", login ]
|
|
res = subprocess.run(uncmds,stdout=subprocess.PIPE)
|
|
line = fh.readline()
|
|
fh.close()
|