SunQuest
           Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old January 17th, 2001, 11:17 PM
rootdr rootdr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 8 rootdr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Veteran web administrators!

I want to learn to be like the big boys in web serving. I have a problem that I cannot find the answer to anywhere related to Apache running on Linux, so I would be grateful for some help:

How do I prevent a user from browsing a directory that contains my images but still allows the images to be served to any HTML pages that call them? When a user changes the URI for my site to access the images folder, e.g. http://www.abcdom.com/images/, the entire listing of all the images and other directories is listed, just like an ftp site. I want to prevent the user from being able to do this.

I thought changing the permissions of the directories with chmod 500 would give the user a forbidden error (error 500) which would work, but then the images will not load when called by HTML.
For example http://www.adobe.com uses CSS from the directory /ssi/css/ to give each browser/platform combination a customized style sheet, which I can view using the URL http://www.adobe.com/ssi/css/mac_ns.css, for example, BUT I can NOT just browse the directory /ssi/css/.
How do they do this?
I do not have my own server, so I cannot change the httpd.conf file, only using .htaccess files and permissions through telnet.

Many thanks for anyone who can help me!

rootdr


[Edited by rootdr on 01-18-2001 at 09:56 AM]

Reply With Quote
  #2  
Old January 18th, 2001, 10:30 AM
NeedApacheAdvice NeedApacheAdvice is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 7 NeedApacheAdvice User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am not sure what you need, but usually if you put an empty file index.html in your directory, this will solve the problem.

Reply With Quote
  #3  
Old January 19th, 2001, 01:00 PM
tkung tkung is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: Southern California (transplant)
Posts: 11 tkung User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
CHMOD your directory

I made this mistake my first time around. The problem is that directory permissions are completely different from file permissions.

If you "chmod 711" on a file (resulting in settings like this: -rwx--x--x), that would allow a user to execute that file. But if you "chmod 711" to the /directory/ that contains the file (drwx--x--x), you're simply allowing the user to access the file if they know its name. Whether they can read, write, or execute the file itself will be set by the file's permissions.

So you just need to chmod your /images/ directory to something like 711. Then set permissions of the gif and jpg files themselves to something like 744 (-rwxr--r--), which will allow users to read those images. Presto: Now users can access the images if they can name them. If they can't, then the directory cannot be browsed.

That should do the trick. (I'm not in front of my Linux box, so please let me know if this doesn't work.)

A pretty good summary of the differences between file permissions and directory permissions can be found here:

http://www.washington.edu/computing...ermissions.html

Cheers,
Tim

Reply With Quote
  #4  
Old January 20th, 2001, 01:12 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Stop messing with the permissions any further if you don't know what you are doing.

To stop a directory listing, simply put this line in your http://www.abcdom.com/images/.htaccess:

Options -Indexes

no more, no less. It's just that simple.

Reply With Quote
  #5  
Old January 20th, 2001, 10:48 AM
rootdr rootdr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 8 rootdr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

Thanks a million tkung! That's exactly what I wanted to know!

It is really great to have access to a body of such knowledgeable people who are willing to help others without being condescending.

Once again, many thanks!

rootdr

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Deny directory browsing-help?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway