change example
This commit is contained in:
parent
6a0c42f86b
commit
e1b3bc814c
@ -34,14 +34,14 @@ def main():
|
|||||||
uname = elements[0]
|
uname = elements[0]
|
||||||
uid = elements[1]
|
uid = elements[1]
|
||||||
passwd = elements[2]
|
passwd = elements[2]
|
||||||
subprocess.check_call("adduser -D -H -u ", shlex.quote(uid), shlex.quote(uname), shell=True)
|
subprocess.check_call("adduser -D -H -u " + shlex.quote(uid) + " " + shlex.quote(uname), shell=True)
|
||||||
print("Added user " + uname + " with uid " + uid)
|
print("Added user " + uname + " with uid " + uid)
|
||||||
if (len(elements) == 4):
|
if (len(elements) == 4):
|
||||||
gname = elements[3]
|
gname = elements[3]
|
||||||
subprocess.check_call("addgroup " + shlex.quote(uname) + " " + shlex.quote(gname), shell=True)
|
subprocess.check_call("addgroup " + shlex.quote(uname) + " " + shlex.quote(gname), shell=True)
|
||||||
print("Added user " + uname + " to group " + gname)
|
print("Added user " + uname + " to group " + gname)
|
||||||
# set passwd
|
# set passwd
|
||||||
subprocess.check_call("echo -ne " + shlex.quote("\n" + passwd + "\n" + passwd + "\n") + " | smbpasswd -a -U " + shlex.quote(uname), shell=True)
|
subprocess.check_call("echo -ne " + shlex.quote(passwd + "\n" + passwd + "\n") + " | smbpasswd -a -U " + shlex.quote(uname), shell=True)
|
||||||
print("Set user " + uname + " password to " + passwd)
|
print("Set user " + uname + " password to " + passwd)
|
||||||
|
|
||||||
main()
|
main()
|
Loading…
Reference in New Issue
Block a user