Configuring SELinux to allow the sharing of a directory by Samba

Tested on RHEL6/CentOS6.

As root:

# mkdir /data
# ls -dZ /data
drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 /data
#┬ásemanage fcontext -a -t samba_share_t ‘/data(/.*)?’
# restorecon -R /data
# ls -dZ /data
drwxr-xr-x. root root unconfined_u:object_r:samba_share_t:s0 /data

You may also want to run the following:
setsebool -P samba_export_all_rw 1

Leave a Reply

Your email address will not be published. Required fields are marked *