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 <?php
echo exec ('whoami');
exec ('/path/to/copy');
(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.

FreeBSD www.domain.tld 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Mon Feb 13 09:28:07 MST 2006 [EMAIL PROTECTED]:/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)

freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to