Cannot seem to find an answer which includes all of the specifics of my situation. I followed instructions in Sharing a mounted drive with samba on CentOS7, but still have a problem. I have CentOS 7 and a NTFS USB drive connected to it. I would like to share using Samba that drive with my other windows machines (Windows 10). I have successfully mounted the drive to /mymnt/win folder, and I can read the drive from the Linux host machine AND see the share from Windows 10 machine. However, when I attempt to browse into the share from windows I get a "You do not have permission to access \mediapc\LewisData7TB." I can access anonymously a pure Linux share from windows as well.

Here's the relevant /etc/fstab file entry:

/dev/sda2 /mymnt/win ntfs-3g rw,umask=0000,defaults 0 0 -o context="system_u:object_r:samba_share_t:s0"

Here's my /etc/samba/smb.conf file (homes/printers/print$ are all commented out):

workgroup = LEWISFAM
server string = Samba Server %v
netbios name = mediapc
dns proxy = no
security = user
map to guest = Bad User
passdb backend = tdbsam

printing = cups
printcap name = cups
load printers = yes
cups options = raw

path = /shares/anonymous
guest ok = yes
browsable = yes
writeable = yes

path = /mymnt/win
browsable =yes
writable = yes
guest ok = yes
read only = no

When I attempt to configure for SELinux I do this command:

chcon -t samba_share_t /mymnt/win/

I get this error:

chcon: failed to change context of /mymnt/win/ to system_w:object_r:samba_share_t:s0: Operation not supported.

So, my goal is to access to read/write this drive from windows, but not quite there yet.

  • If there are no SELinux errors in audit log, it likely is a regular permission issue. – sebasth Feb 8 at 5:29
  • Fedora Project Q&A: NTFS does not support SELinux attributes. Try mount -o remount,context=system_u:object_r:samba_share_t:s0 /dev/sdxY – Kenneth B. Jensen Feb 8 at 6:03
  • This is not a fix, but more information. I temporarily suspended SELinux using thegeekdiary.com/centos-redhat-how-to-set-selinux-modes. setenforce permissive. This allows me now to browse into the drive from my windows machine and create files/folders (read/write). So, it is related to SELinux. – Greg Lewis Feb 9 at 3:54
  • Kenneth, my original post shows the fstab entry with the -o parameter as you recommend... So, I don't think the remount command (not supported anyway on my Centos 7) will have any effect. – Greg Lewis Feb 9 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.