Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Secure apache folders?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
zeveck
Apprentice
Apprentice


Joined: 17 Mar 2005
Posts: 173
Location: Boston, MA

PostPosted: Sun Oct 16, 2005 8:31 pm    Post subject: Secure apache folders? Reply with quote

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
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Sun Oct 16, 2005 8:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
zeveck
Apprentice
Apprentice


Joined: 17 Mar 2005
Posts: 173
Location: Boston, MA

PostPosted: Sun Oct 16, 2005 8:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Sun Oct 16, 2005 9:58 pm    Post subject: Reply with quote

Code:
Options -Indexes


No directory listings. Simple as that.
Back to top
View user's profile Send private message
zeveck
Apprentice
Apprentice


Joined: 17 Mar 2005
Posts: 173
Location: Boston, MA

PostPosted: Mon Oct 17, 2005 12:10 am    Post subject: Reply with quote

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
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Mon Oct 17, 2005 9:14 am    Post subject: Reply with quote

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
View user's profile Send private message
pdr
l33t
l33t


Joined: 20 Mar 2004
Posts: 618

PostPosted: Mon Oct 17, 2005 8:44 pm    Post subject: Reply with quote

Make the directory outside of your documentroot.
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Mon Oct 17, 2005 9:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
pdr
l33t
l33t


Joined: 20 Mar 2004
Posts: 618

PostPosted: Tue Oct 18, 2005 9:21 am    Post subject: Reply with quote

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
View user's profile Send private message
zeveck
Apprentice
Apprentice


Joined: 17 Mar 2005
Posts: 173
Location: Boston, MA

PostPosted: Tue Oct 18, 2005 12:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
xces
Guru
Guru


Joined: 11 Oct 2002
Posts: 515

PostPosted: Tue Oct 18, 2005 2:28 pm    Post subject: Reply with quote

Have you read the howto Authentication, Authorization and Access Control in the Apache manual? :roll:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum