Centos – Samba not allowing access to /var/www folder

centossamba

I have a local webserver that I want to have samba access to. In my smb.conf everything seems to be working except I cannot access the www folder. I have full permissions on it and have tried everything I can think of in my smb.conf config.

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
guest account = nobody
map to guest = bad user
security = user
dns proxy = no
wins support = yes
name resolve order = wins lmhosts host bcast
#============================ Share Definitions ==============================
[Webserver]
path = /var
browsable =yes
writable = yes
guest ok = yes
read only = no
[www]
path = /var/www
public = yes
writable = yes
comment = smb share
printable = no
guest ok = yes
create mode = 0777
directory mode = 0777

I am able to get into the Webserver share and open folders except www and on the www share it won't open the error is you do not have permissions to access www folder.

Best Answer

This is due to SELINUX. Try putting it in permissive mode, issuing setenforce 0 and test if Samba now works. If it works and you want to refine your configuration, you can tag /var/www with the public_content_rw_t label and re enable selinux with setenforce 1

For more information, see here