change example

This commit is contained in:
quackerd 2021-02-19 18:52:24 -05:00
parent e1d3254de2
commit 7e0dd8a12e
Signed by: d
GPG Key ID: F73412644EDE357A

View File

@ -38,15 +38,13 @@ def main():
cmd = "adduser -D -H -u " + shlex.quote(uid) + " " + shlex.quote(uname)
print(cmd)
subprocess.check_call(cmd, shell=True)
print("Added user " + uname + " with uid " + uid)
if (len(elements) == 4):
gname = elements[3]
cmd = "addgroup " + shlex.quote(uname) + " " + shlex.quote(gname)
print(cmd)
subprocess.check_call(cmd, shell=True)
print("Added user " + uname + " to group " + gname)
# set passwd
cmd = "echo -ne " + shlex.quote(passwd + "\n" + passwd + "\n") + " | smbpasswd -a -U " + shlex.quote(uname)
cmd = "echo -ne \"" + shlex.quote(passwd) + "\\n" + shlex.quote(passwd) + "\\n\" | smbpasswd -a -U " + shlex.quote(uname)
print(cmd)
subprocess.check_call(cmd, shell=True)