Re: Execute command line as a different user
| From: | Dan Joseph | Date: | Tue, 01 Jul 2008 17:29:07 +0000 |
| Subject: | Re: Execute command line as a different user | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276186@lists.php.net to get a copy of this message | ||
On Tue, Jul 1, 2008 at 1:17 PM, Matt palermo <mpalermo@vt.edu> wrote:
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I did a quick check on php.net, there is a post on there that talks about
using sudo:
@exec("echo 'apache' | /usr/bin/sudo -u mail -S /var/www/html/mailset.sh
$name");
You may want to read thru it, php.net/exec, go to the user notes.
--
-Dan Joseph
www.canishosting.com - Plans start @ $1.99/month.
"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."