Can I get clarification on how to properly set up samba folder shares on a RHEL/CENTOS 7 linux server having selinux enforcing.
SELinux requires files to have an extended attribute to define the file type. Policy governs the access daemons have to these files. If you want to share files other than home directories, those files must be labeled samba_share_t. So if you created a special directory /var/eng, you would need to label the directory with the chcon tool.
To make this change permanent (survive a relabel), use the semanage command to add the change to file context configuration
chcon -t samba_share_t /data
semanage fcontext -a -t samba_share_t /data
or
semanage fcontext -a -t samba_share_t /data*
- Do I always need to do the
chcon -t samba_share_t /folderto make it work, or can I get away with just doing thesemanage? - Do I need to
chcon -t samba_share_tjust the folder that is to be listed in/etc/samba/smb.confor do I need to label every sub folder and file under the samba shared folder? - Likewise with the
semanage fcontext -a -t samba_share_t, do I only apply this to just the single folder specified as the share in/etc/samba/smb.conf, or does it require it be applied to every file and sub folder under the samba shared folder and if so how is that done?