Re: Execute command line as a different user
| From: | Matt Palermo | Date: | Tue, 01 Jul 2008 20:52:14 +0000 |
| Subject: | Re: Execute command line as a different user | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276195@lists.php.net to get a copy of this message | ||
I'm using the following command and I'm not getting any feedback:
exec("echo 'adminPass' | sudo -u adminAccount -S whoami", $f, $r);
Both $f and $r don't contain any data. This leads me to believe that the command is not being run for whatever reason. Is there something wrong with this command? Is there a different way to do it?
Thanks,
Matt
""Matt palermo"" <mpalermo@vt.edu> wrote in message news:08.EE.06277.4C66A684@pb1.pair.com...
My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt