LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 05-04-2007, 08:17 PM   #1
breadfan311
LQ Newbie
 
Registered: Nov 2006
Location: Malaysia
Posts: 14

Rep: Reputation: 0
Hiding Image Files In Web Server


Hi,
Currently when someone types in the url for my image file (eg. www.example.com/image/example.jpg), the image will appear in their browser. How am I able to hide the image from the rest of the world. Please help. Thanks.
 
Old 05-04-2007, 08:41 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by breadfan311
Hi,
Currently when someone types in the url for my image file (eg. www.example.com/image/example.jpg), the image will appear in their browser. How am I able to hide the image from the rest of the world. Please help. Thanks.
What are you trying to do? prevent other sites from linking to your images or preventing anyone from seeing the image at all?

You can change the read permissions so that only the owner can read it (assuming the web server does not run as you). You can use apache's rewrite engine to stop anyone viewing an image unless they are reffered by your site. You can put the image in a directory not accessible by your web server.
 
Old 05-04-2007, 10:14 PM   #3
breadfan311
LQ Newbie
 
Registered: Nov 2006
Location: Malaysia
Posts: 14

Original Poster
Rep: Reputation: 0
Hi,
Actually I want to prevent others from viewing the image directly when they type in the location of the file that I have mentioned above. However I only want others to be able to view the image from the page that I have the image linked to.

Example of an image that others are able to view when typing the location of the image.
http://www.google.com.my/intl/en_com...logo_plain.png
 
Old 05-05-2007, 07:06 AM   #4
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
AFAIK that's not possible...

When your browser is loading the image as part of a page on your site, or as a direct request for the image, the web server doesn't know any different.

Is there a specific reason you're trying to achieve this, or just general paranoia?
 
Old 05-13-2007, 03:35 AM   #5
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Rep: Reputation: 39
I think you are looking for .htaccess. google on how to use that and for a quick start try http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch20_:_The_Apache_Web_Server
So that only the authorize ones can see the images or whatever is in that location.
 
Old 05-13-2007, 03:35 AM   #6
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Rep: Reputation: 39
I think you are looking for .htaccess. google on how to use that and for a quick start try http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch20_:_The_Apache_Web_Server
Look for .htaccess section there.
So that only the authorize ones can see the images or whatever is in that location.
 
Old 05-13-2007, 04:23 AM   #7
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
.htaccess will stop the requests from the actual page that the OP does want the images on, unless the 'client' enters valid credentials...
 
Old 05-13-2007, 07:29 PM   #8
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by BrianK
You can use apache's rewrite engine to stop anyone viewing an image unless they are reffered by your site.
I think this is a good idea. However, this can be circumvented by apps like wget very easily.
 
  


Reply



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
Hiding downloadable files vxc69 Programming 7 10-26-2006 01:17 PM
LXer: Backup MySQL databases, web server files to a FTP server automatically LXer Syndicated Linux News 0 08-11-2006 09:54 PM
Same permissions on two files, but only one can be accessed by web server? murr4y Linux - Software 5 06-14-2005 02:59 AM
Getting files off web server itgl72 Linux - Newbie 5 08-11-2003 07:59 PM
hiding web directories labr@ LinuxQuestions.org Member Success Stories 1 08-04-2003 01:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:08 AM.

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
Open Source Consulting | Domain Registration