Re: calling rsync from php script
| From: | Daniel Brown | Date: | Tue, 13 May 2008 14:02:27 +0000 |
| Subject: | Re: calling rsync from php script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274247@lists.php.net to get a copy of this message | ||
On Tue, May 13, 2008 at 4:32 AM, Jean-Christophe Roux <jcxxr@yahoo.com> wrote:
> Hello,
>
> I have a bash script update.sh that contains:
> rsync -- delete -avz -e ssh ${files} root@64.XXX:/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.