![Samba 共享可访问但访问被拒绝](https://linux22.com/image/723561/Samba%20%E5%85%B1%E4%BA%AB%E5%8F%AF%E8%AE%BF%E9%97%AE%E4%BD%86%E8%AE%BF%E9%97%AE%E8%A2%AB%E6%8B%92%E7%BB%9D.png)
我有以下 samba 配置(Centos7):
[global]
netbios name = HomeAssistant
server string = The HA File Center
workgroup = WORKGROUP
hosts allow =
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
remote announce =
remote browse sync =
[HOME ASSISTANT]
path = /home/homeassistant
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = yes
public = yes
create mask = 0777
directory mask = 0777
force user = homeassistant
force create mode = 0777
force directory mode = 0777
hosts allow =
我有一个 homeassistant 用户,我给了它一个 samba 密码。当我在 Windows 中连接到共享时,我看到一个“home assistant”文件夹。
但当我尝试打开它时,我收到一条拒绝访问消息。
/home/homeassistant 文件夹配置如下:
drwxr-xr-x. 4 homeassistant homeassistant 119 Jun 18 22:44 homeassistant
我不再确定我此时错过了什么。
答案1
禁用selinux
已解决的事情,但如果您想启用它,请使用以下命令:
chcon -R -t samba_share_t /home/homeassistant
samba
这将允许通过访问目录selinux
。如果selinux
启用,则需要在任何共享上运行该命令。之后samba
请务必重新启动服务。smb