Re: chmod->serve file->chmod back?
| From: | Stephen Hui | Date: | Mon, 26 Jun 2000 13:30:53 +0000 |
| Subject: | Re: chmod->serve file->chmod back? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3115@lists.php.net to get a copy of this message | ||
This is how I'm interpreting the question: you want these web files to
be accessible only to the web server and no one else at all times, such
that anyone who wants to see them must go through the web site.
If this is the case, you could change the owner of the files to be the
web server, i.e. suppose the server process runs as user webserv, then
webserv should own the files and directory structure. Then, if you put
600 on all the files, it should be read/write for webserv only, and no
one else, not even users in the same group, should be able to read/write
the files. Then you don't need to do any chmod'ding at all in your
scripts.
Another option to try would be to set permission on the directory to
600. Then the rest would be the same as above.
If the web developer needs to add/modify/delete files, they would log in
as the web server user and they would have full read/write permissions
to the directory and files.
(I'm pretty sure these will work, but don't take my word for it!)
Hope this helps,
Stephen.
P.S.--I assume you're using UNIX.... I'm not sure how it would work
under NT.
Brady Brown wrote:
>
> Hi,
>
> I am trying to change permissions on a file, web serve
> the content and then change the permissions back so that
> users cannot see the content unless its via
> the script (no, people, i'm not running a porn site).
>
> Something like this:
>
> <?PHP
>
> chmod("test.jpg",0644);
>
> print "<img src='test.jpg'>;
>
> flush();
>
> chmod("test.jpg",0600);
>
> ?>
>
> This only works sometimes. If I put a "sleep();" after
> the print, it works more often the higher the argument is
> for sleep. I assume this means that if the websever
> doesn't touch the file before the permissions are changed
> back, tough luck.
>
> Any ideas to make this work? Or is there a more obvious
> solution for this that I am too dense to see?
>
> Much thanks,
>
> Brady
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Computer Terms: Programmer - A red-eyed, mumbling mammal
capable of conversing with inanimate objects.
Stephen Hui, ARL:UT, Austin, TX