Error 403 forbidden on Linux localhost with symlink

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Error 403 forbidden on Linux localhost with symlink

Postby GunChleoc » 28. September 2019 10:12

Hi all,

I am trying to set up XAMPP on a localhost for testing. The installation went through without a problem and I am seeing the dashboard.

I am now trying to symlink a local folder as a subdirectory of htdocs, and I keep getting this:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403
localhost
Apache/2.4.41 (Unix) OpenSSL/1.1.1c PHP/7.3.9 mod_perl/2.0.8-dev Perl/v5.16.3


I tried diverse things from STFW and nothing worked. This is the current state of my files:

/opt/lampp/etc/httpd.conf:
Code: Select all
DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/htdocs">
    Options Indexes FollowSymLinks ExecCGI Includes
    Order allow,deny
    Allow from all
    AllowOverride All
    Require all granted
</Directory>

# Failed attempt that I commented out
#<Directory "/opt/lampp/htdocs/symlink_to_my_directory">
#    AllowOverride AuthConfig Limit
#    Order allow,deny
#    Allow from all
#    Require all granted
#</Directory>


/opt/lampp/apache2/httpd.conf:
Code: Select all
Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"

<Directory "/opt/lampp/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>


Permissions for my directory are: drwxrwxr-x

I added symlinks to my directory to both /opt/lampp/htdocs and /opt/lampp/apache2/htdocs and their permissions are lrwxrwxrwx

My directory contains an index.php file with permissions -rw-rw-r--

Thank you for your time.
GunChleoc
 
Posts: 4
Joined: 28. September 2019 09:55
XAMPP version: 7.3.9-0
Operating System: Linux Mint 19.1

Re: Error 403 forbidden on Linux localhost with symlink

Postby GunChleoc » 28. September 2019 15:32

I have now tried to mimic the file system permissions to match the ones in the dashboard, e.g. by calling

Code: Select all
sudo chown -R root:root *


I also tried nobody:root as recommended by https://community.apachefriends.org/f/viewtopic.php?t=49184 and that didn't work either.
GunChleoc
 
Posts: 4
Joined: 28. September 2019 09:55
XAMPP version: 7.3.9-0
Operating System: Linux Mint 19.1

Re: Error 403 forbidden on Linux localhost with symlink

Postby Nobbie » 28. September 2019 17:17

Probably there is a problem with the symbolic link, maybe its broken. Please show us an output of "ls -la" in /opt/lampp/htdocs and show us the symbolic link.

Finally run "file <symlink_name>" in htdocs and show us the response.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Error 403 forbidden on Linux localhost with symlink

Postby GunChleoc » 28. September 2019 17:31

The symlink dir is called "ginbeag"
Code: Select all
cuideigin@inneal:/opt/lampp/htdocs $ ls -la
total 64
drwxr-xr-x  5 root      root       4096 Sult  28 15:10 .
drwxr-xr-x 30 root      root       4096 Sult  28 09:07 ..
-rw-r--r--  1 root      root       3607 Lùna  27 15:02 applications.html
-rw-r--r--  1 root      root        177 Lùna  27 15:02 bitnami.css
drwxr-xr-x 21 root      root       4096 Sult  28 09:03 dashboard
-rw-r--r--  1 root      root      30894 Mhàrt 11  2007 favicon.ico
lrwxrwxrwx  1 cuideigin cuideigin    39 Sult  28 15:10 ginbeag -> /media/cuideigin/Linux/sources/ginbeag/
drwxr-xr-x  2 root      root       4096 Sult  28 09:03 img
-rw-r--r--  1 root      root        260 Iuch   9  2015 index.php
drwxr-xr-x  2 daemon    daemon     4096 Sult  28 09:03 webalizer


Code: Select all
cuideigin@inneal:/opt/lampp/htdocs $ file ginbeag
ginbeag: symbolic link to /media/cuideigin/Linux/sources/ginbeag/


And the direct properties:
Code: Select all
cuideigin@inneal:/media/cuideigin/Linux/sources $ ls -la
total 34176
<snip>
drwxrwxr-x 12 cuideigin cuideigin     4096 Sult  28 15:12 ginbeag


And the index files:
Code: Select all
cuideigin@inneal:/media/cuideigin/Linux/sources/ginbeag$ ls -la
<snip>
-rw-rw-r--  1 cuideigin cuideigin    76 Sult  28 15:11 index.html
-rw-rw-r--  1 cuideigin cuideigin  1809 Sult  28 09:01 index.php
GunChleoc
 
Posts: 4
Joined: 28. September 2019 09:55
XAMPP version: 7.3.9-0
Operating System: Linux Mint 19.1

Re: Error 403 forbidden on Linux localhost with symlink

Postby Nobbie » 28. September 2019 21:35

/media is a folder for external devices. These are mounted for current users only, not for Apache User. I dont think that Apache (which runs with a different UserID) can connect to "cuideigin" media. Therefore you get error 403. The only way to connect Apache to external media is to run it with the same UserID as the user, which connects the media.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Error 403 forbidden on Linux localhost with symlink

Postby GunChleoc » 29. September 2019 08:10

Yes, that was it. I took the easy way out and moved the data below my home directory.

Thanks for your help!
GunChleoc
 
Posts: 4
Joined: 28. September 2019 09:55
XAMPP version: 7.3.9-0
Operating System: Linux Mint 19.1


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 35 guests