Welcome to the most active Linux Forum on the web.
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 04-19-2011, 01:17 AM   #1
Registered: Nov 2006
Posts: 91

Rep: Reputation: 27
Apache 2.2.17 + CIFS + symlinks = error


I have an LFS system with the latest Apache. Everything on the system is working properly. I have however noticed a very strange and annoying problem with Apache.

I would like to serve some documents off an XP system. I mounted the XP system on /mnt/xp. There are other things I want access to on the XP system, so the documents to serve on the web are located at /mnt/xp/webdocs.

I created a symlink in my Apache DocumentRoot to point to /mnt/xp/webdocs. (e.g. /home/www/htdocs/docs -> /mnt/xp/webdocs)

Upon trying to access this link ( I get the following in error_log

[Mon Apr 18 23:52:42 2011] [error] [client] Symbolic link not allowed or link target not accessible: /home/www/htdocs/docs
I already have FollowSymLinks set for my entire site in the Directory section. I also have EnableSendfile off to prevent some known problems with kernel caching and file sending from CIFS shares.

The odd part of this is:

1. If I create a symlink to somewhere on the local filesystem (e.g. /home/www/htdocs/link -> /bin) I can see everything in /bin in a listing and access it. This means that FollowSymlinks isn't the problem.

2. If I create a symlink to somewhere outside the CIFS share, and then FROM THAT POINT navigate into the share, it works. (e.g. /home/www/htdocs/link -> /mnt, and then This shows it's not an issue of httpd not being able to access the content. Obviously doing it this way is a HUGE security hole and opens up all sorts of other issues.

3. The problem only occurs if I am trying to access a symlink that points to somewhere inside a CIFS share.

Has anyone observed this behavior/know what's causing it? Is there anything I can do to fix it?

My "temporary" fix was to create a second share on the XP box and mount it directly under /home/www/htdocs/docs. This works, but it's not preferable at all, as in some other projects I'm working on it may not be as predictable where the content will be located on the Windows machine.

As a side note, this used to work fine in Apache 2.0.x...


Old 04-21-2011, 04:43 AM   #2
LQ Newbie
Registered: Dec 2009
Posts: 18

Rep: Reputation: 2
Hi fmillion

- Did you check the access properties for the file/tree on your windows box?
- Did you verify whether /mnt/xp/webdocs is mounted (hard/soft/automount mounted) on /home/www/htdocs/docs and that it is readable/writeable,for the webserver too?

Old 04-21-2011, 08:50 PM   #3
Registered: Nov 2006
Posts: 91

Original Poster
Rep: Reputation: 27
Hello zjoske, thanks for your reply.

The problem definitely appears to be with Apache's resolving of symlinks that point directly into a CIFS mounted filesystem. I used Sudo to run a Bash shell under the apache user and was able to freely access the files. The mount is explicit and I verified it.

As I said in my original post, the part that leads me to believe this is a symlink resolution bug is that if I mount the cifs filesystem inside the apache htdocs folder, it works. It is only if I attempt to symlink to a cifs filesystem. Just to test this, I tried mounting the cifs filesystem inside the htdocs folder then symlinking into it from there, and it still failed. (e.g. I mounted the xp share on /home/www/htdocs/xp and went to and saw the content, then I made a symlink like /home/www/htdocs/xplink -> ./xp and another like /home/www/htdocs/xpdocs -> ./xp/docs and then accessing and and both failed.)

Thanks, if anyone has further advice, please post.

Old 06-03-2013, 05:20 PM   #4
LQ Newbie
Registered: Jun 2013
Posts: 1

Rep: Reputation: Disabled
Work Around

I ran into an almost identical problem on Ubuntu(Precise) running Apache 2.2. I could not find the source of the problem but I was able to create a work around. Instead of symlinking to the mounted directory I bound the new directory to the mounted directory using mount -B olddir newdir.

Hope it helps.
Old 10-07-2014, 04:39 PM   #5
LQ Newbie
Registered: Jun 2004
Posts: 3

Rep: Reputation: 0
mount -B worked for me.

sudo mount -B /mnt/courses ~/mnt_courses

Thanks for the tip!


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
Cifs "mount error 13 = Permission denied" CIFS SUCKS humbletech99 Linux - Networking 44 02-26-2016 01:45 PM
Apache 403 Forbidden error when accessing cifs mount guapo42 Linux - Newbie 3 11-16-2009 04:06 PM
Creating symlinks on a CIFS share? MasterC Linux - General 2 08-30-2007 05:34 PM
Apache Symlinks gdw Linux - Networking 1 02-27-2003 08:38 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:41 PM.

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