Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 10395 invoked from network); 13 May 2008 14:23:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 May 2008 14:23:28 -0000 Received: (qmail 61928 invoked by uid 500); 13 May 2008 14:23:18 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 61910 invoked by uid 500); 13 May 2008 14:23:18 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 61899 invoked by uid 99); 13 May 2008 14:23:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2008 07:23:18 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [216.138.240.12] (HELO mail.acerenting.com) (216.138.240.12) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2008 14:22:29 +0000 Received: from HP72472929110 (unknown [69.77.163.53]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mail.acerenting.com (Postfix) with ESMTP id EF5BC158004A for ; Tue, 13 May 2008 10:29:17 -0400 (EDT) Message-ID: <07ec01c8b505$0d85de00$35a34d45@HP72472929110> Reply-To: "Danie Qian" From: "Danie Qian" To: References: <909158.84781.qm@web35301.mail.mud.yahoo.com> Date: Tue, 13 May 2008 10:24:07 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_07E1_01C8B4E3.79ED9B90" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [users@httpd] call rsync from php script ------=_NextPart_000_07E1_01C8B4E3.79ED9B90 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable ----- Original Message -----=20 From: Jean-Christophe Roux=20 To: users@httpd.apache.org=20 Sent: Tuesday, May 13, 2008 5:59 AM Subject: [users@httpd] call rsync from php script 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 The rsync line is ignored.=20 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? Thank you. =20 add this line in your /etc/sudoers apache ALL=3D(ALL) NOPASSWD:/usr/bin/rsync and change your rsync command to=20 sudo rsync -- delete -avz -e ssh ${files} root@64.XXX:/red ------=_NextPart_000_07E1_01C8B4E3.79ED9B90 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable
----- Original Message -----
From:=20 Jean-Christophe=20 Roux
Sent: Tuesday, May 13, 2008 = 5:59 AM
Subject: [users@httpd] call = rsync from=20 php script

Hello,

I have a bash script update.sh=20 that contains:
rsync -- delete -avz -e ssh ${files} root@64.XXX:/red
when I use that = script=20 ./update.sh as root, it works like a charm as I set up the = private/public key=20 properly.
When run from a php script through the apache=20 webserver
<?php
exec("update.sh");
?>
The=20 rsync line is ignored.
I understand that the php script is called = under=20 the apache user, when the private/public key is for my root user. How = can I=20 set the the keys so that the apache user can run fully the php=20 script?

Thank you.


 
 
 
add this line in your = /etc/sudoers
 
apache =20 ALL=3D(ALL)      =20 NOPASSWD:/usr/bin/rsync
 
and change your rsync command to =
sudo rsync -- delete -avz -e ssh ${files} root@64.XXX:/red
------=_NextPart_000_07E1_01C8B4E3.79ED9B90--