Using shell_exec('passwd') to change a user's password
问题 I need to be able to change the users' password through a web page (in a controlled environment). So, for that, I'm using this code: <?php $output = shell_exec("sudo -u dummy passwd testUser testUserPassword"); $output2 = shell_exec("dummyPassword"); echo $output; echo $output2; echo "done"; ?> My problem is that this script is not changing the password for the user "testUser". What am I doing wrong? Thanks 回答1: Another option is to have a shell script, say called passwd_change.sh somewhere