[CentOS] You have not permission to view content of this location

Jonathan Billings billings at negate.org
Wed Dec 7 14:19:03 UTC 2016


On Wed, Dec 07, 2016 at 05:08:11PM +0800, truename wrote:
> sudo chown u1 /data
> sudo chgrp g1 /data
> 
> sudo chmod ugo+rwx /data
> 
> I edit /etc/samba/smb.conf:
> 
> [data]
>     comment = data
>     path = /data
>     valid users = u1,u2
>     write list = u1,u2
>     create mask = 0777
>     sync always = Yes
> ;    hide dot files = yes
> ;    writeable = no

Out of curiosity, I ran:

# matchpathcon /data
/data	system_u:object_r:etc_runtime_t:s0

I'm not sure why /data is labeled etc_runtime_t, but I suspect that's
why you can't export its contents via Samba, SELinux is probably
preventing it.

I suggest following the directions here:
https://wiki.centos.org/HowTos/SetUpSamba#head-86233024cba06a1e4f554e763a2f634a61eae9b8

and run:

semanage fcontext -a -t samba_share_t '/data(/.*)?'
restorecon -R /data

-- 
Jonathan Billings <billings at negate.org>



More information about the CentOS mailing list