PDA

View Full Version : [SOLVED] Xampp Error: Symbolic link not allowed or link target not accessible



Soorin
March 18th, 2012, 09:27 PM
I have installed the Xampp stack and created a symlink from home/user/Dropbox/wwwFiles to /opt/lampp/htdocs/wwwFiles, my problem is that I can't access the content of the wwwFiles folder.
In the error_log file it says: "Symbolic link not allowed or link target not accessible: /opt/lampp/htdocs/wwwFiles"
I have changed the owner and the group on both the folder to be the same nobody and nogroup, I have added the Options FollowSymLinks to the httpd.conf but with no luck, I still can't access the files in the wwwFiles.
Does somebody has a solution to this issue?!
Thank you.

lechien73
March 18th, 2012, 09:39 PM
Hi & welcome to the Ubuntu forums,

It could be because the owner of the symlink doesn't match the owner of the symlinked files. This is a security feature of Apache to prevent symlink attacks.

If you're sure that your server is secure, then you can add the following options to your httpd.conf file:


Options +FollowSymLinks -SymLinksIfOwnerMatch

Soorin
March 18th, 2012, 10:19 PM
I have tried that before and the same problem.

Soorin
March 20th, 2012, 07:21 PM
Nobody has a working solution?

Lars Noodén
March 20th, 2012, 08:38 PM
Nobody has a working solution?

XAMPP is the wrong way to go about setting up a web server for Linux. All distros, Ubuntu included, have package managers which take care of downloading and installing. That includes tracking version changes and security updates. You should use the package manager to install the LAMP components.

So one solution would be to wipe /opt/lampp and start over by installing the components of your L (Linux), A (Apache/Lighttpd/nginx), M (MySQL/Postgresql), P (Perl/Python/PHP) system:


apt-get install openssh-server apache2 php5 mysql-server


Perl is built in, so that's why you don't need to add it.

With that, you'll find your web pages in a standard location (initially /var/www) and same for your other components.

If you really want to work with XAMPP, you can still do that, but it's not the best or even a good way.

Soorin
March 21st, 2012, 08:48 PM
Hello Lars, thank you for your suggestion.
I'm not trying to setup a production server is just for local propose.
I have fallowed your suggestion and deleted xampp.
I'm having the same problem "Symbolic link not allowed or link target not accessible: /var/www/test"
I have the same owner and group on test folder and www folder and all files in the www folder.
Any suggestion?

Lars Noodén
March 21st, 2012, 08:55 PM
Hmm. What happens when you open a terminal and track the activity in the error log when you produce the error?



tail -f /var/log/apache2/error.log

Soorin
March 22nd, 2012, 06:52 PM
I get this:

[Thu Mar 22 19:43:37 2012] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/test

Lars Noodén
March 22nd, 2012, 07:04 PM
Did you make a symbolic link there? That seems to be what might have happened.

What is the output of ls?



ls -lh /var/www/


We'll look to see if there is a link present.

Soorin
March 22nd, 2012, 07:12 PM
I have a symlink,

ls -lh /var/www/
lrwxrwxrwx 1 sorin sorin 24 2012-03-21 21:31 test -> /home/sorin/Dropbox/test

Lars Noodén
March 22nd, 2012, 07:26 PM
Does the target (/home/sorin/Dropbox/test) exist?

Soorin
March 22nd, 2012, 08:07 PM
Yes the folder exists:

ls -l /home/sorin/Dropbox/test
-rwxrwxrwx 1 sorin sorin 39 2012-03-21 21:32 index.html

Lars Noodén
March 22nd, 2012, 08:24 PM
I'm not able to duplicate your error on my system. I have Apache2 set up with no modification to the configuration and it still works when I symlink to a folder within my home directory. I've also tried changing owners of the symlink, but Apache still serves it up. I'm not sure what you have that is different. What changes did you make to the configuration?

Soorin
March 22nd, 2012, 08:34 PM
I only added these lines to the httpd.conf:

<Directory /var/www/test>
Options FollowSymLinks
</Directory>
The httpd.conf file was empty, is this normal?

Soorin
March 24th, 2012, 09:45 PM
I have fixed the problem.
In the httpd.conf file I have added:

User sorin
Group sorin
where sorin is the owner and the group for both the symbolic link and the target link.
Maybe this helps someone.

mevsme
December 16th, 2012, 03:50 AM
Yes, it helped me too. But it's so non-obvious solution %) I'm angry a lot.
ps: i'm trying developing with drop box as well.

nikhilsheth
May 17th, 2013, 05:42 AM
Soorin, thanks!
I only had to edit httpd.conf and add the lines:
User nikhil
Group nikhil
..as you advised ('nikhil' is my ubuntu user name)
And Voila! On restarting the server (I'm using XAMPP), I was able to access a "Documentaries" folder that's on my external HDD which I'd symlinked into the /opt/lampp/htdocs .
It also worked over my home's WiFi network on an Android phone.. I just had to browse to 192.168.1.2/Documentaries/
And I can now play TED Talks, which are sitting in my HDD, on the Android phone, without even having to download them :) :)

The earlier Options.. tip had no effect. This User and Group lines did the trick.