<p>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:</p>

<pre><code>&lt;?php
$output = shell_exec("sudo -u dummy passwd testUser testUserPassword");
$output2 = shell_exec("dummyPassword");
echo $output;
echo $output2;
echo "done";
?&gt;
</code></pre>

<p>My problem is that this script is not changing the password for the user "testUser".
What am I doing wrong?</p>

<p>Thanks</p>

I'm not familiar enough with PHP to tell you how to fix it, but your problem is that the two
```
shell_exec
```
commands are entirely separate. It appears as though you're trying to use the second command to pipe input to the first one, but that's not possible. The first command shouldn't return until after that process has executed, when you run the second one it will attempt to run the program
```
dummyPassword
```
, which we can probably expect to fail.