LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 01-12-2009, 08:45 AM   #1
wikignu
LQ Newbie
 
Registered: Aug 2008
Posts: 1

Rep: Reputation: 0
deny accessing the dir but still allow images in the dir to be used by 'HTML'


deny 'directly' allow 'indirectly' (.htaccess)

I am running apache web server on CentOS5.2
I have the directory in which stores a lot of images.(/var/www/html/images)
I want to deny everyone from directly accessing the directory but still allow images in the directory to be used by 'HTML' (/var/www/html/pic.html <img src="http://localhost/images/hotimg.jpg">)

=>someone cannot access that specific directory directly.
1)create .htaccess in images directory
2)type following lines and save
order allow,deny
deny from all

but I don't know how to allow images in the directory to be used by HTML(pic.html <img src="http://localhost/images/hotimg.jpg">)

thanks in advance

Last edited by wikignu; 01-12-2009 at 11:07 AM.
 
Old 01-12-2009, 09:58 AM   #2
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Hi,

you should be able to do that with Apache, but I did a quick test and manage to protect it by changing the permissions on the images directory:

Code:
# chmod 110 images
Hope this helps as a quick fix.
 
Old 01-12-2009, 10:04 AM   #3
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
... and for the proper way to do things:

This should do it with a chmod 750. You might be able to do better. Read the apache doc.
Code:
<Directory "/var/www/foobar/images/">
 AllowOverride None
 Options -Indexes -MultiViews -FollowSymlinks
 Order deny,allow
 Allow from all
</Directory>

Last edited by eco; 01-12-2009 at 10:17 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync -u Does it update the contents of a dir if that dir is changed? crazyivan Linux - Software 1 04-02-2008 04:08 AM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 03:57 PM
Q. moving /bin dir files to /dev dir?? Texas_student Linux - Software 2 03-27-2006 12:42 AM
Share configuratin dir (.dir) for 3 accounts on local computer LiNuXkOlOnIe Linux - Software 5 01-08-2006 04:36 AM
howto make a dir shared that is not in my home dir Schmurff Linux - Newbie 2 06-19-2004 08:54 PM


All times are GMT -5. The time now is 12:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration