I'm running Apache 2.2 on CentOS 6.5, and I'm having problems accessing a Samba share that I've mounted.
My web root is /var/www/html
, and I've created a folder in the root called intranet
, and I'm mounting the share to that folder using the following line in fstab:
\\remote.server\share\intranet /var/www/html/intranet cifs rw,auto,guest,uid=apache,gid=apache 0 0
I'm able to access this share and read/write it as root. I'm also able to sudo -u apache
to read and write the share. As far as I can tell on a system level, the share is mounted exactly as desired.
However, when I try to access the share by going to http:\\myserver\intranet
I get the following message:
You don't have permission to access /intranet/ on this server.
However, when I umount intranet
, I'm able to successfully access the plain folder intranet
with http:\\myserver\intranet
successfully, which tells me my httpd.conf
and .htaccess
is configured correctly.
As far as I can tell, the problem is that, somewhere along the line, some permission isn't translating correctly. I'm not sure what else I can do to solve this.
EDIT: I realize I didn't say anything, but I also have my httpd.conf and .htaccess files configure to FollowSymLinks
. I've successfully tested this by linking a test directory and accessing it.
Best Answer
Ok, I figured this out. The problem was SELinux.
The policy
httpd_use_cifs
was set to off. I was able to see this by running:Then I saw that
httpd_use_cifs --> off
. All that was left to do was change the policy:Note: the
-P
flag writes the policies to disk so they will persist through reboots. You can omit the -P flag to temporarily test your policy change without committing it to disk.