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 04-01-2009, 01:40 AM   #1
sanjee
Member
 
Registered: Jul 2008
Posts: 129

Rep: Reputation: 15
Arrow Soft link folder / file browsing in APACHE


Can any one please help me regarding to the Soft link folder / file browsing problem in APACHE .

I have created a folder on the /var/www/html named "test" and created one home.html . Now I have created one soft link of home.html file into the test folder named test.html and set 777 file-folder permission .

Its showing error --->> "Forbidden You don't have permission to access /test/test.html on the server"
 
Old 04-01-2009, 05:27 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You have to add "FollowSymLinks" in the Options directive, either for the DocumentRoot, or for the specific directory if you don't want to allow symlinks for the whole server
 
Old 04-01-2009, 05:57 AM   #3
sanjee
Member
 
Registered: Jul 2008
Posts: 129

Original Poster
Rep: Reputation: 15
It is my configuration . Please suggest me .

<VirtualHost 192.168.1.50:80>
ServerAdmin root@helo.mylinux.com
DocumentRoot /var/www/html
ServerName helo.mylinux.com
ErrorLog logs/helo.mylinux.com-error_log-lin
CustomLog logs/helo.mylinux.com-access_log-lin common
<Directory "/var/www/html/test">
options Indexes Includes FollowSymLinks SymLinksifOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

** I have tested also " options Indexes Includes FollowSymLinks " ,, but no result .

Last edited by sanjee; 04-01-2009 at 06:00 AM.
 
Old 04-01-2009, 06:44 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
What is the output of
Code:
ls -l /var/www/html
ls -l /var/www/html/test
If you're running a distro using SELinux, make sure it's not a SELinux permissions problem.
Check also apache error_log to see if you find any hints.
 
Old 04-01-2009, 06:52 AM   #5
sanjee
Member
 
Registered: Jul 2008
Posts: 129

Original Poster
Rep: Reputation: 15
I had disabled SELINUX .
Output of "ls -l /var/www/html/test" is showing the included files listing and softlink in the test folder .

Error log is showing :->>
Symbolic link not allowed or link target not accessible: /var/www/html/test/test.html, referer: http://192.168.1.50/test/

Last edited by sanjee; 04-01-2009 at 07:06 AM.
 
Old 04-01-2009, 07:03 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by sanjee View Post
I had disabled SELINUX .
Its showing the included files listing and softlink in the test folder .
I told you to show us the directory listing to see the file attributes. And you didn't post the apache error_log.
 
Old 04-01-2009, 07:23 AM   #7
sanjee
Member
 
Registered: Jul 2008
Posts: 129

Original Poster
Rep: Reputation: 15
I had recreated the folder and files and provided the permission .

[root@helo ~]# ls -l /var/www/html
total 4
drwxrwxrwx 2 root root 4096 2009-04-01 17:42 test

[root@helo ~]# ls -l /var/www/html/test/
total 4
-rwxrwxrwx 1 root root 8 2009-04-01 17:42 home.html
lrwxrwxrwx 1 root root 9 2009-04-01 17:42 test.html -> home.html

.................................................................................

[Wed Apr 01 17:26:48 2009] [error] [client 192.168.1.50] Symbolic link not allowed or link target not accessible: /var/www/html/test/test.html, referer: http://192.168.1.50/test/
[Wed Apr 01 17:46:13 2009] [error] [client 192.168.1.50] Symbolic link not allowed or link target not accessible: /var/www/html/test/test.html, referer: http://192.168.1.50/test/
[Wed Apr 01 17:46:14 2009] [error] [client 192.168.1.50] Symbolic link not allowed or link target not accessible: /var/www/html/test/test.html, referer: http://192.168.1.50/test/
[Wed Apr 01 17:46:31 2009] [error] [client 192.168.1.50] Symbolic link not allowed or link target not accessible: /var/www/html/test/test.html, referer: http://192.168.1.50/test/
[Wed Apr 01 17:46:31 2009] [error] [client 192.168.1.50] Symbolic link not allowed or link target not accessible: /var/www/html/test/test.html, referer: http://192.168.1.50/test/

Last edited by sanjee; 04-01-2009 at 07:26 AM.
 
Old 04-01-2009, 07:42 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
I guess you have restarted apache after changing httpd.conf.
Try to use +FollowSymLinks and see if it helps
 
Old 04-01-2009, 11:26 PM   #9
sanjee
Member
 
Registered: Jul 2008
Posts: 129

Original Poster
Rep: Reputation: 15
I used " options +FollowSymLinks " ,,,, but not worked . Is it right syntax that i used . Please suggest .
 
Old 04-02-2009, 04:37 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
The syntax is right, that's why it's strange that apache does not follow symlinks.
I'm staring to think that you are not editing the correct file. Is that <VirtualHost ...> snippet you've posted part of httpd.conf, or it's in another file included by an "Include ..." directive in httpd.conf?
 
Old 04-02-2009, 04:59 AM   #11
sanjee
Member
 
Registered: Jul 2008
Posts: 129

Original Poster
Rep: Reputation: 15
I m editing /etc/httpd/conf/httpd.conf file and its Fedora core . There everything is OK , except the symbolic link .

Last edited by sanjee; 04-02-2009 at 05:01 AM.
 
Old 04-02-2009, 06:33 AM   #12
sleddog
Member
 
Registered: Jan 2002
Location: Labrador, Canada
Distribution: CentOS, Debian
Posts: 182

Rep: Reputation: 35
Your config:

Code:
options Indexes Includes FollowSymLinks SymLinksifOwnerMatch
Probably, SymLinksifOwnerMatch is overriding FollowSymLinks. The symlinked directory is owned by root, so the owner does not match and linking is denied.

Try removing SymLinksifOwnerMatch from your config and restart Apache.
 
Old 04-02-2009, 06:49 AM   #13
sleddog
Member
 
Registered: Jan 2002
Location: Labrador, Canada
Distribution: CentOS, Debian
Posts: 182

Rep: Reputation: 35
Scratch that, after re-reading I see you already tried it.

In your config you have your DocumentRoot set to /var/www/html, but your do not have a "Directory" configuration for that directory.

If you want the DocumentRoot to be /var/www/html/test then set:

DocumentRoot /var/www/html/test

Alternately, if you want /test to be a browseable subdirectory, change the "Directory" configuration to:

<Directory "/var/www/html">

However you do it, you should have a "Directory" config that matches your DocumentRoot.
 
Old 04-02-2009, 08:50 AM   #14
sanjee
Member
 
Registered: Jul 2008
Posts: 129

Original Poster
Rep: Reputation: 15
Actually I want the document root path would be /var/www/html . But there would be one folder where I want to use for soft link purpose , that's why I used <Directory "/var/www/html/test"> . Here I m able to browse other files except symbolic linking files .
 
Old 04-02-2009, 09:05 AM   #15
sleddog
Member
 
Registered: Jan 2002
Location: Labrador, Canada
Distribution: CentOS, Debian
Posts: 182

Rep: Reputation: 35
Then you should have something like...

Code:
DocumentRoot /var/www/html

<Directory "/var/www/html">
options Indexes Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<Directory "/var/www/html/test">
options +FollowSymLinks
</Directory>
 
  


Reply

Tags
apache, browsing, softlink



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
Changing a soft link to actual file? jdiemer Linux - Newbie 4 04-05-2006 11:45 AM
Forbidden access to soft link on apache web server bnj Linux - Software 3 05-03-2005 08:14 AM
copy both soft link and its linked file okeyla Programming 3 02-13-2005 11:30 PM
file browsing experience - I don't want a new window per folder.. sokar Fedora 9 07-08-2004 07:22 PM
apache new folder link zeky Linux - General 6 09-01-2002 07:34 PM

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

All times are GMT -5. The time now is 02:42 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
Open Source Consulting | Domain Registration