Re: Could someone look at my problem in shell-exec?
| From: | Ernest E Vogelsinger | Date: | Thu, 22 May 2003 20:53:56 +0000 |
| Subject: | Re: Could someone look at my problem in shell-exec? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148639@lists.php.net to get a copy of this message | ||
At 22:34 22.05.2003, love jiangnan said:
--------------------[snip]--------------------
>All the files are under my own directory and created
>by myself.
>
>could you tell me how can I give user permission? Or
>should I talk to admin to give user permission?
--------------------[snip]--------------------
Create a subdirectory in your home directory, e.g. "webcache". Then make it
world-writeable:
mkdir ~/webcache
chmod 777 ~/webcache
Now create a small script that creates a file in webcache (you must use the
full path to that directory, the webserver doesn't know about your "~" home
shortcut):
<?php
$hf = fopen('/home/jiang/webcache/test', 'w');
echo 'Creating the file ', ($hf ? 'succeeded' : 'failed');
?>
After running this script once there should be a file in ~/webcache. Try to
list it:
ls -l ~/webcache
-rw-r--r-- 1 apache www 0 May 22 22:50 test
Now you see which user and which group the web server uses - in this
example it's the user "apache", group "www" (most probably different at
your site).
Since you don't want the webcache directory to be world read/writeable,
change its GID to the web servers GID, then remove the dangerous world rights:
chown :www ~/webcache
chmod 770 ~/webcache
Now you and the webserver will be able to read and write to ~/webcache, but
no one else. (Of course you may delete the "test" file after that...)
Hope this helps,
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/