Re: Execute command line as a different user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 1, 2008 at 1:17 PM, Matt palermo <mpalermo@xxxxxx> 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."

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux