Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gkbijarniya committed Jan 18, 2016
1 parent f806817 commit 386a207
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@ def passencrypt(cmd): # encrypt the password
def isUserExist(user): # check if user is exist or not
cmd = ["id", user]
rcode=command(cmd)
print rcode
# print rcode
return rcode

def addUser(username,shell,homedir,passwd): # add a system user using system commands
passoutput=passencrypt(["/usr/bin/sudo", "/usr/bin/openssl", "passwd", "-crypt", str(passwd)])
returnCode=command(["/usr/bin/sudo", "/usr/sbin/useradd", "-m", "-d", str(homedir), "-s", str(shell), "-p", str(passoutput.strip()), username])
print username,shell,homedir,passwd
# print username,shell,homedir,passwd
return returnCode

def modUser(username,shell,homedir,passwd): # modify a system user using system commands
passoutput=passencrypt(["/usr/bin/sudo", "/usr/bin/openssl", "passwd", "-crypt", str(passwd)])
returnCode=command(["/usr/bin/sudo", "/usr/sbin/usermod", "-d", str(homedir), "-s", str(shell), "-p", str(passoutput.strip()), username])
print username,shell,homedir,passwd
# print username,shell,homedir,passwd
return returnCode

def delUser(username): # delete user
Expand Down

0 comments on commit 386a207

Please sign in to comment.