Jump to content


Photo

Chmod help


  • Please log in to reply
6 replies to this topic

#1 play_

play_
  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 21 September 2006 - 04:21 AM

Probably not the right forum, sorry.

Say i have this site:
http://example.com/

The main logo image, is located in http://example.com/images/logos/

Anyone using firefox can right-click the image and select 'view image', opening the image in the browser with the full url on the address bar, like so:
http://example.com/i...s/someimage.jpg

so if the person deleted 'someimage.jpg' from the address bar, he will be in "http://example.com/images/logos/" viewing all of its contents.

How can i stop that? i set chmod to 711, but then index.php will give me this error:

Warning: opendir(./images/logos/): failed to open dir: Permission denied in /hsphere/local/home/me/example.com/includes/classes.php on line 13
Could not open directory for main image selection.


classes.php is where i have the script to open and select a random image from the logos folder.


I would post my actually site here, but then people could navigate through my files, and i'd rather not let that happen.
I will gladly PM it if needed.

Thank you.

regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin

#2 warewolfe

warewolfe
  • Members
  • PipPipPip
  • Advanced Member
  • 57 posts
  • LocationOtago, NZ

Posted 21 September 2006 - 04:38 AM

Hej

put "IndexIgnore *.gif *.jpg" in your htaccess file to block listing of image files.

WW.


#3 play_

play_
  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 22 September 2006 - 03:04 AM

Thanks for the reply.
I did that, but now the main page does not get the image from the logo directory.
so www.example.com, the image won't show.
regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin

#4 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 22 September 2006 - 03:38 AM

Turn off Apache's indexing:

<Directory />
    Options -Indexes
</Directory>

Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#5 sKunKbad

sKunKbad
  • Members
  • PipPipPip
  • Advanced Member
  • 1,832 posts
  • LocationTemecula, CA, USA

Posted 22 September 2006 - 05:02 AM

just create an .htaccess file in your images folder with:

Options -Indexes

in it, and people will no longer have access to your images folder in list view.
Brian's Web Design - Temecula

Freedom is only available through death.

#6 play_

play_
  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 22 September 2006 - 03:46 PM

Thanks guys.

Effigy, I would prefer not to turn off apache's indexing, because there might be folders I would want to allow indexing
regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin

#7 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 22 September 2006 - 03:49 PM

Just use
<Directory /images>
    Options -Indexes
</Directory>
instead then.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users