Fix in unix.py

This commit is contained in:
absurdo 2023-05-26 01:37:39 +02:00
parent 023ae57225
commit 6318ece7e1

View file

@ -56,11 +56,11 @@ def change_password(user, new_password):
try:
user_pwd=pwd.getpwnam(user)
if call("sudo echo \"%s:%s\" | chpasswd" % (user, new_password), shell=True, stdout=DEVNULL) > 0:
if call("sudo echo \"%s:%s\" | sudo chpasswd" % (user, new_password), shell=True, stdout=DEVNULL) > 0:
return (True, 'Change password successfully')
else:
return (False, 'I cannot change password')
return (False, 'I cannot change password, permissions?')
except KeyError: