I\'m having problems with changing a Linux user\'s password from python. I\'ve tried so many things, but I couldn\'t manage to solve the issue, here is the sample of things
For those that --stdin isn't an option:
import subprocess cmd = "bash -c \"echo -e 'NewPassword\\nNewPassword' | passwd root\"" subprocess.check_call(cmd, shell=True)