之前在本地的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
保存后重啟服務器
