0

Platform : Centos 7

Scenario : I have a drive "/mnt/ELEMENTERY-1TB" mounted with fstab

UUID=a6339f33-1c61-4c2c-a490-04c83ccfb4d6 /mnt/ELEMENTERY-1TB/ ext4 defaults,errors=remount-ro,context="system_u:object_r:samba_share_t:s0" 0 1 -,

Which i want to share on local network via simple apache directory listing.

  • Created symlink ln -sd /mnt/ELEMENTERY-1TB/ /var/www/html/.

I Can access other folder through directory listing which are not symlinked,

[root@271 html]# ls -al
total 8
drwxr-xr-x. 4 apache apache   68 Sep 12 12:14 .
drwxr-xr-x. 4 root   root     33 Sep 10 15:14 ..
drwxr-xr-x. 7 root   root   4096 Sep  2 01:47 ds ###can access this
lrwxrwxrwx. 1 root   root     20 Sep 12 12:01 ELEMENTERY-1TB -> /mnt/ELEMENTERY-1TB/
drwxr-xr-x. 4 root   root     72 Sep 10 16:23 _h5ai ### can access
-rw-r--r--. 1 root   root    166 Sep 12 12:14 .htaccess

Tried to give permission to symlink "ELEMENTERY-1TB" chown apache:apache -R ELEMENTERY-1TB/

What can be possible error ?

Rahul V Sharma
  • 141
  • 2
  • 7
  • Without the actual message from the Apache httpd error_log it is hard to say what the issue might be. – HBruijn Sep 12 '17 at 07:01
  • there is no error in error_log and access_logs loggin browser info as usual, Permissions are the culprit here i think. – Rahul V Sharma Sep 12 '17 at 07:10
  • Are you getting `404 not found` error or some other error? – Khaled Sep 12 '17 at 07:43
  • @Khaled Nope, i am not getting any error, directory listing is showing file in /var/www/html, but not showing symlinked directory which /mnt/ELEMENTERY-TB in this case – Rahul V Sharma Sep 12 '17 at 07:54

1 Answers1

1

You're mounting the file-system with the option context="system_u:object_r:samba_share_t:s0"

By default SELinux does not permit httpd access to CIFS shares. You might want to try either a different SELinux context or set the boolean setsebool -P httpd_use_cifs=on

HBruijn
  • 72,524
  • 21
  • 127
  • 192