Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-17-2013, 01:27 PM   #1
Registered: Jul 2013
Posts: 51

Rep: Reputation: Disabled
trying (out of curiosity) to link a desktop image to html(Apache on Debian)

Hi.I'm trying to link a desktop image In html on a Debian machine running Apache.I can link to a copy of the image from within var/www (root folder for default website)with " <img src="Image.jpg"> but
" <img src="file:///home/username/Desktop/Image.jpg"> doesn't work.It's not a permission Issue.
Is there some directive or configuration In apache that might be preventing me from linking to a directory other than /var/www ?
I'm just curious as to why It's not working, I don't have a specific reason for using a directory other than var/www.
Old 12-17-2013, 02:01 PM   #2
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137
When a user goes to a web address, they see
They can modify or go to anything they want by replacing "path_to_something" (either directly or when directed there by an embedded html image or a link). When they do, it translates to /var/www/path_to_something on your machine (or wherever the Apache root is located).

When you stick a file:// directive, that sends them to:
Which then translates into:
Which is of course nonsense.

Everything works on relative locations in Apache (or if it's absolute, it must be an absolute WEB address, not an absolute location on your filesystem). You could symlink the file into /var/www so that it will be accessible, but you can't go throwing arbitrary locations on your filesystem into html pages. If you could, it would be a MASSIVE security risk. If somebody could access
what would keep them from accessing
or your network configuration, or share names, or hostnames of other machines on your network. Just by sticking a "file://" directive in the web address they could have nearly limitless access to your local filesystem.

You can think of the Apache root like a chroot jail for web users. They can only access what's inside that directory. As far as they're concerned, that's the root of the filesystem, there are no higher level or sister directories, only files and subdirectories within /var/www/.

Last edited by suicidaleggroll; 12-17-2013 at 02:08 PM.
Old 12-17-2013, 02:05 PM   #3
Registered: Jul 2013
Posts: 51

Original Poster
Rep: Reputation: Disabled
That makes sense.Thanks for the Information !


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
running apache on local machine, called from html file (debian) mzzxx11 Linux - Newbie 4 12-27-2012 05:19 PM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 08:40 AM
PHP: how can I return an image - not the html img src tag, but the image data BrianK Programming 3 05-18-2007 03:28 PM
php image blob managing cannot get image from html ilpadrino Programming 6 04-15-2007 10:05 AM
which link shld i use to download debian image? solutionseeker Linux - Newbie 12 01-12-2005 07:02 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:03 AM.

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