LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   CentOS - Enable directory browsing on a linked directory. (https://www.linuxquestions.org/questions/linux-server-73/centos-enable-directory-browsing-on-a-linked-directory-4175558112/)

systemlordanubis 11-05-2015 04:04 PM

CentOS - Enable directory browsing on a linked directory.
 
Hi All,

I have a CentOS server upon which I need to serve up a folder enabling directory browsing.

The directories are as follows:

/var/www/html < Site Root
/var/www/html/index.html < File redirects browser to /linkdir
/var/www/html/lnkdir < Symlink to /mnt/linkdir
/mnt/linkdir < Contents to be read as directory listing.

All of the above folders have permissions of 750 or 755.


I've configured the httpd.conf file with the following options:

DocumentRoot "/var/www/html"
<Directory "/var/www">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Require all granted
</Directory>


However, when connecting to the server, I can successfully reach index.html and it redirects me to /linkdir but then I receive an error 403 - permission denied.

The error_log shows:
[negotiation:error] [pid 19483] (13)Permission denied: [client xxx.xxx.xxx.xxx:7817] AH00686: cannot read directory for multi: /var/www/html/linkdir/, referer: http://mydomain.com/


I've searched on this issue and most others seem to resolve it with permissions, but my permissions seem to be correct.

Does anyone know how to resolve this issue?

Thanks
Anubis.

berndbausch 11-05-2015 05:54 PM

If /mnt/linkdir has permissions 750, only owner and group have access.

More likely, Centos uses SELinux, which some people consider a pain in the neck, but it makes your system more secure. I suppose httpd can't access /mnt/linkdir because SELinux confines it to /var/www.
If so, /var/log/audit/audit.log will contain lines explaining why the access to /mnt/linkdir failed.

You then have to tell SELinux that it's OK for httpd to access this directory tree. I don't remember the commands off the cuff, but you won't have any trouble finding them on the internet (or somebody with a better memory might chime in here).

chrism01 11-05-2015 11:41 PM

Lookup semanage fcontext .... you probably want httpd_sys_rw_content_t but check that.


All times are GMT -5. The time now is 12:36 PM.