今天在安装samba服务的时候,系统中已经设置了用户为smb1,用户组为users
[global] netbios name = SERVER.REDHAT.SUN server string = Samba Server Version %v log file = /var/log/samba/log.%m max log size = 50 load printers = No idmap config * : backend = tdb cups options = raw[homes] comment = Home Directories read only = No browseable = No[project] comment = smbuser's project path = /home/project write list = @users read only = No
项目名称为project,目录为/home/project,通过windows访问samba服务器的时候,列出了project和smb1目录,project目录可以进入浏览,无法新建,无写入权限,而smb1用户主目录无法进入,查看SElinux状态:
[root@server ~]# getenforce Enforcing
半闭SELINUX
[root@server ~]# setenforce 0
可以正常访问以及新建目录和文件,怀疑是SELINUX的原因,打开SELINUX,然后设置/etc/samba/smb.conf
setsebool -P samba_enable_home_dirs on
设置完成后运行:chcon -t samba_share_t /home/project
[root@server ~]# ls -ldZ /home/project/drwxrws---. root users unconfined_u:object_r:samba_share_t:s0 /home/project/
用windows客户端测试samba,可以正常访问!