Re[2]: [PHP] cURL in an exec() . more

From: Date: Wed, 03 Jul 2002 14:58:14 +0000
Subject: Re[2]: [PHP] cURL in an exec() . more
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-105213@lists.php.net to get a copy of this message
Hello Jay, That wasn't what i recommended you LOL :). Ok from the beginning PHP executes and writes files with permissions (like userid and groupid) Webserver is running. So what i think will be the best way for you to do. Is to create an executable with the same owner. and then execute it. As for /usr/local/bin directory it allows to write in it only to root or superuser. I recommend you to create a user like foo then in his home directory create a subdirectory like web and chmod it to 777. and use it as an output for the script. Got an idea? Also you always can use /tmp directory :) Wednesday, July 3, 2002, 6:49:08 PM, you wrote: JB> OK, here is where I am (between handling other pre-holiday/long weekend JB> processese here); JB> I have the PHP script create a shell script containing the needed code for JB> the cURL process. Of course the shell script will execute from the command JB> line with me as 'root'. But the exec() that calls the shell script will not JB> execute the script because of improper permissions. (Has to do with the JB> permissions on the topmost directory for where the file lives, changing that JB> could be dangerous from a security standpoint). JB> So I have tried to change those (I am on a Linux box) via the PHP, no luck. JB> It will let me chmod the shell script via the PHP script. So I tried to move JB> the script to /usr/local/bin; JB> rename("getlist.sh", "/usr/local/bin/getlist.sh"); Permission denied JB> exec("mv getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied JB> exec("cp getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied JB> I am looking into posix_setuid() to change the permissions for the time JB> needed, but I've a feeling, after a couple of tests, that this is not going JB> to be the way to do this either. JB> I wish permissions in Linux were more straigtforward. Anyone have an idea JB> how to do this with opening the server wide? Thanks for all your help. JB> Jay -- Best regards, Latex mailto:freeman@submission.org.ru

« previous php.general (#105213) next »