Re: [PHP] calling rsync from php script

[email protected] ("Daniel Brown")
Newsgroups php.general
Message-ID <[email protected]>
On Tue, May 13, 2008 at 4:32 AM, Jean-Christophe Roux <[email protected]> wrote:
> Hello,
>
>  I have a bash script update.sh that contains:
>  rsync -- delete -avz -e ssh ${files} [email protected]:/red
>  when I use that script ./update.sh as root, it works like a charm as I set up the private/public key properly.
>  When run from a php script through the apache webserver
>  <?php
>  exec("update.sh");
>  ?>
>  The rsync line is ignored.

    You could use a combination of BASh and Expect shell code here,
but it wouldn't be very secure, because that would automate the root
login.

>  I understand that the php script is called under the apache user, when the private/public key is for my root user. How can I set the the keys so that the apache user can run fully the php script?
>  More generally, how do php users handles the ssh private/public keys when calling rsync?

    Generate keys for `nobody` or `apache` (whatever user as which
Apache is being executed).  Alternatively, install phpSuExec, Suhosin,
or suPHP so that the scripts are run as the user for which they were
called.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.