View previous topic :: View next topic |
Author |
Message |
zeveck Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/166839645642bdd5ac72cb4.gif)
Joined: 17 Mar 2005 Posts: 173 Location: Boston, MA
|
Posted: Sun Oct 16, 2005 8:31 pm Post subject: Secure apache folders? |
|
|
How do I make it so that apache will not surve up a given folder to a web user?
Say there are files in that folder that I want the user to be able to download. Any pointers on how to make it so that user can download them via a PHP script? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
adaptr Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/17218567054377b9b6104ea.jpg)
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Sun Oct 16, 2005 8:47 pm Post subject: |
|
|
Plenty. Google for "apache download php scripts" and you'll be reading the rest of the year...
You need to think about what it is you want - there are at least 3 different concepts and/or questions in your post.
The first one can already be achieved in 3 different ways (or more). _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zeveck Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/166839645642bdd5ac72cb4.gif)
Joined: 17 Mar 2005 Posts: 173 Location: Boston, MA
|
Posted: Sun Oct 16, 2005 8:58 pm Post subject: |
|
|
Quote: | Google for "apache download php scripts" and you'll be reading the rest of the year... |
Agreed...but it would seem in a needle-in-a-haystack kinda way. I tried Google, but for instance, the search you suggested turns up nothing relevant in the first two pages of results. It is too cluttered with downloads of numerous apache and PHP scripts, etc.
What I want to do, precisely is:
Make it so that a user cannot just navigate to htdocs/uploads, but still be able to download files stored in said location. The naive approach to achieve the former is to just set the folder permissions so that the user cannot access it. But then I cannot figure out how to make it so that the user can actually download a file that is stored in that folder.
I assume PHP can facilitate this, but my searches so far have resulted in a very low signal to noise ratio. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Monkeh Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/158504026146c5220a4feda.png)
Joined: 06 Aug 2005 Posts: 1656 Location: England
|
Posted: Sun Oct 16, 2005 9:58 pm Post subject: |
|
|
No directory listings. Simple as that. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zeveck Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/166839645642bdd5ac72cb4.gif)
Joined: 17 Mar 2005 Posts: 173 Location: Boston, MA
|
Posted: Mon Oct 17, 2005 12:10 am Post subject: |
|
|
Not quite what I meant. I mean, then the user could still just do /uploads/foo.txt if they guessed the file name, right? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Monkeh Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/158504026146c5220a4feda.png)
Joined: 06 Aug 2005 Posts: 1656 Location: England
|
Posted: Mon Oct 17, 2005 9:14 am Post subject: |
|
|
Yes. The only other way I can think of is passworded folders, or perhaps strict referer blocking. However, you could always just go with hard to guess file names. Try.. uploads/f0O.txt for example. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
pdr l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/Southpark/avatar20.gif)
Joined: 20 Mar 2004 Posts: 618
|
Posted: Mon Oct 17, 2005 8:44 pm Post subject: |
|
|
Make the directory outside of your documentroot. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
adaptr Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/17218567054377b9b6104ea.jpg)
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Mon Oct 17, 2005 9:34 pm Post subject: |
|
|
And they will be able to download files.. how, exactly ? _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
pdr l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/Southpark/avatar20.gif)
Joined: 20 Mar 2004 Posts: 618
|
Posted: Tue Oct 18, 2005 9:21 am Post subject: |
|
|
Uh.. I thought the whole point here is to make it so people can't download files? Or is this a case of "I want to secure some of the files in a directory"? If so - move them into a different directory, serve one directory, don't serve the other directory. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zeveck Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/166839645642bdd5ac72cb4.gif)
Joined: 17 Mar 2005 Posts: 173 Location: Boston, MA
|
Posted: Tue Oct 18, 2005 12:48 pm Post subject: |
|
|
Doesn't work. I want to serve all files in a directory, but only to specific users. It is a problem if other users could get at the files just by guessing the URL. The question is how to secure the directory and still somehow make the files available.
(nice avatar) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
xces Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Monkey Island/Monkey_Island_-_Monkey.gif)
Joined: 11 Oct 2002 Posts: 515
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|