From owner-freebsd-questions@FreeBSD.ORG Fri Dec 1 07:12:37 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C1F1816A407 for ; Fri, 1 Dec 2006 07:12:37 +0000 (UTC) (envelope-from rastill@shaw.ca) Received: from pd5mo3so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6DCC43C9D for ; Fri, 1 Dec 2006 07:12:24 +0000 (GMT) (envelope-from rastill@shaw.ca) Received: from pd3mr5so.prod.shaw.ca (pd3mr5so-qfe3.prod.shaw.ca [10.0.141.12]) by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0J9L00FC62KRTZB0@l-daemon> for freebsd-questions@freebsd.org; Fri, 01 Dec 2006 00:10:03 -0700 (MST) Received: from pn2ml10so.prod.shaw.ca ([10.0.121.80]) by pd3mr5so.prod.shaw.ca (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0J9L00F392KR24Q0@pd3mr5so.prod.shaw.ca> for freebsd-questions@freebsd.org; Fri, 01 Dec 2006 00:10:03 -0700 (MST) Received: from New ([70.65.134.12]) by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with SMTP id <0J9L00L5E2KRUAP0@l-daemon> for freebsd-questions@freebsd.org; Fri, 01 Dec 2006 00:10:03 -0700 (MST) Date: Fri, 01 Dec 2006 00:10:04 -0700 From: Ray Still To: freebsd-questions@freebsd.org Message-id: <039401c71517$b9ef5750$6700a8c0@New> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Outlook Express 6.00.2900.2180 Content-type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original Content-transfer-encoding: 7bit X-Priority: 3 X-MSMail-priority: Normal Subject: problem with script execution X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2006 07:12:37 -0000 Hello; I have a problem that I have put considerable time into, but I keep coming up empty. short form is that the script works from the command line, but doesn't work from a php script. (I've already stumped the php list.) details follow. I have a shell script , 'copy' consisting of 4 lines echo * | sudo -u admn -S rm /path/to/file1 echo * | sudo -u admn -S cp /some/path/to/source1 /path/to/file1 echo * | sudo -u admn -S rm /path/to/file2 echo * | sudo -u admn -S cp /some/path/to/source2 /path/to/file2 copy is owned by www:www and is mode 777 file1 and file2 are owned by admn:www and are mode 666 copy, file1 and file2 are in the same directory which is owned by www:www and is mode 777 I have enabled targetpw in the sudoers file as www doesn't really have a password. I also have a php script (just for the sake of completeness, exec passes a command to the OS and echo prints what ever is passed to it.) my output is "www" which is the expected result of the whoami for the php/apache user. however no file changes happen. however, from root: sudo -u www /path/to/copy changes the files exactly as expected/desired. any suggestions/pointers/links would be appreciated. system: FreeBSD www.domain.tld 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Mon Feb 13 09:28:07 MST 2006 user@www.domain.tld:/usr/src/sys/i386/compile/WWW i386 Apache/2.2.3 (FreeBSD) mod_ssl/2.2.3 OpenSSL/0.9.7e-p1 PHP/5.1.5 (potentially sensitve info removed) Ray