LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-05-2015, 04:04 PM   #1
systemlordanubis
Member
 
Registered: Jun 2010
Distribution: Debian, Ubuntu, Win
Posts: 143

Rep: Reputation: 16
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.
 
Old 11-05-2015, 05:54 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
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).
 
Old 11-05-2015, 11:41 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
Lookup semanage fcontext .... you probably want httpd_sys_rw_content_t but check that.
 
  


Reply


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
Can't source a linked directory from another user Leo Simon Linux - General 4 08-25-2009 12:48 AM
Java phone directory using linked lists snowman81 Programming 1 11-27-2007 07:35 PM
vsftpd and chroot_local_user / issue with linked directory blizunt7 Linux - Security 3 08-20-2007 11:18 AM
How to enable directory browsing inside public_html? gepesz Linux - Networking 1 07-23-2004 04:11 PM
How to unlink a directory that is not linked? J_Szucs Linux - Newbie 5 01-09-2003 10:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration