之前在本地的CentOS虚拟机上配置 Samba 服务器没有遇到过这种问题, 刚才在我的阿里云服务器上配置Samba上下文时, 报出了这个错误
chcon -t samba_share_t /home/suozhiyuan/
chcon: can't apply partial context to unlabeled file '/home/suozhiyuan/'
找了很久的资料, 发现问题是出在 selinux 放火墙上, 这个防火墙的配置文件为 /etc/selinux/config
配置内容:
原来是关闭: SELINUX=disabled
改成打开: SELINUX=enforcing
# This file controls the state of SELinux on the system. # 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.
#改成
SELINUX=enforcing
# SELINUXTYPE= can take one of these three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
保存后重启服务器