so here is what I did, I think my main problem was incorrectly typing syntax which is why I was having problems.
- I have an 8 disk raid-5 volume via LSI raid card in a server; it had been formatted as XFS and mounted under SLES 11.4 for the last ~10 years.
- replaced the one operating system disk and now running RHEL 7.8 with selinux enforcing.
- I mount my XFS file system as
/data under RHEL 7. the following syntax is imperative especially for semanage
-
semanage fcontext -a -t samba_share_t "/data(/.*)?"
restorecon -vR /data
# to samba share out home directories, if in your smb.conf
setsebool -P samba_enable_home_dirs on
Now one can possibly do chcon -t samba_share_t /data/folder1/folder2/folder3
but that quickly becomes a non solution when you have 10 years worth of data and millions of files/folders. It was a quick diagnostic when selinux=enforcing and access was denied to a particular sub folder; doing a chcon -t samba_share_t would then allow immediate access to said sub folder. The solution seemed to be the proper syntax when using semanage fcontext with the " followed by the restorecon -vR
The semanage took about 30 seconds to complete, and the restorecon about 2 minutes, on 5TB worth of data.
If curious:
/etc/fstab` is this in RHEL 7.8
/dev/disk/by-uuid/e16528d8-ec26-4441-828a-d399b46e4a21 /data auto nosuid,nodev,nofail 0 0
# ------------------------------------------------------------------------
/etc/samba/smb.conf
[global]
workgroup = SAMBA
security = user
passdb backend = tdbsam
printing = bsd
printcap name = /dev/null
load printers = no
disable spoolss = yes
# cups options = raw
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
[data]
comment = data
inherit acls = Yes
read only = No
path = /data
directory mask = 770
create mask = 660
# ------------------------------------------------------------------------
/etc/selinux/config
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUX=enforcing
SELINUXTYPE=targeted