LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 12-17-2013, 12:27 PM   #1
Reprovo
Member
 
Registered: Jul 2013
Posts: 59

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, 01:01 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
When a user goes to a web address, they see
Code:
http://subdomain.domain/path_to_something
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:
Code:
http://subdomain.domain/file:///home/username/Desktop/Image.jpg
Which then translates into:
Code:
/var/www/file:///home/username/Desktop/Image.jpg
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
Code:
http://subdomain.domain/file:///home/username/Desktop/Image.jpg
what would keep them from accessing
Code:
http://subdomain.domain/file:///etc/passwd
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 01:08 PM.
 
Old 12-17-2013, 01:05 PM   #3
Reprovo
Member
 
Registered: Jul 2013
Posts: 59

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


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
running apache on local machine, called from html file (debian) mzzxx11 Linux - Newbie 4 12-27-2012 04:19 PM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 07: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 02:28 PM
php image blob managing cannot get image from html ilpadrino Programming 6 04-15-2007 09:05 AM
which link shld i use to download debian image? solutionseeker Linux - Newbie 12 01-12-2005 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:26 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