简体   繁体   中英

Symbolic link not allowed or link target not accessible

I have a folder somewhere on my webserver and a symlink to this folder from a public_html of another user. For the purpose of centralizing some content.

I can perfectly include files from within this symlinked folder. However, I can not access a file (eg test.html or test.php) directly.

If I try to access a file directly I get a forbidden error in the browser and in the log files I see:

Symbolic link not allowed or link target not accessible

I have tried to edit the httpconf as I found on the internet, tried to put a .htaccess in the folder where the symlink recides etc. But nothing has helped so far.

Additional info: My webserver runs CentOS release 6.5 (Final) Apache 2.2.27

permissions to the parentfolder of the linked folder: 777

Permissions to the linked folder: 777

I have set them from 644 to 777 for testing purposes

And please note that I am a programmer running into problems, not a linux expert :)

*** I still do not have a working solution. I can use the files by including them, just fine, just not call any files directly eg images, stylesheets. I have no idea what other details to give that will help solve this problem. The permissions are ok for the link, folder and parentfolder Changing the owner of either link or folder does also not give any results Options FollowSymLinks in .htaccess in the folder with the link, the parent of that folder, the destination folder and parent of destination folder, it does all not seem to help. I can just not execute files and really need to

It turned out that the symlink itself needed to be owned by the same user as the original linked folder

chown -R username: linkname

That did the trick for me

You can check the rights with

 ls -la

Then it looks a little wierd to see all the files owned by the actual user, except for the symlink, which is owned by the original user.

Hope this helps others with a similar issue as well!

first of all I would recommend to include some details in your question. Eg the permissions of dirs and files would be helpful, what distro etc.

My crystal ball analysis: - You web-server (apache) runs as user www-data - Your php runs a suexec user A / user b. - The www-data user, cannot access the file, because the permission for www-data is not sufficient on the file or it's parent dir (!).

You could do:

$ sudo -u www-data ls -lah /path/to/your/file

... to see, what your webserver users sees.

$ ls -lah  /path/to/your/file

... to check, what permissons are set to the file. (group/world readable?)

$ ls -dlah  /path/to/your

... to check the permissions on parent dir (need x flag for www-data),

HTH, j.

在Apache配置的<Directory>块中或.htaccess文件中:

Options FollowSymLinks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM