服务器 1:10.0.0.10
smb.conf:
[global]
workgroup = WORKGROUP
Server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[public]
comment = Public share
path = /mnt/public
browsable = yes
read only = no
guest ok = yes
force user = nobody
create mask = 0777
directory mask = 0777
[apps]
path = /mnt/torrents/apps
writable = yes
browseable = yes
public = yes
create mask = 0644
directory mask = 0755
force user = shareuser
这按预期工作。从 Windows 7 客户端,我可以使用 \10.0.0.10\public 访问共享
服务器 2:10.0.0.4
smb.conf:
[global]
workgroup = WORKGROUP
Server string = %h server (Samba, Raspbian)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[public]
comment = Public share
path = /mnt/public
browsable = yes
read only = no
guest ok = yes
force user = nobody
create mask = 0777
directory mask = 0777
在此服务器上,无法从同一 Windows 客户端访问共享。\10.0.0.4\public 导致
“Windows 无法访问 \10.0.0.4\public...错误代码:0x80070035 未找到网络路径。
我的问题:这怎么可能呢?Samba 共享 100% 相同,两台服务器都连接到同一个交换机/路由器,并且从整个 LAN 都可以访问。例如,SSH 和 FTP 对于 10.0.0.4 来说运行良好。但出于某种难以理解的原因,Windows 无法访问它。任何服务器上都没有防火墙,而且它们都是最普通的。
我以前一直对 Samba 耿耿于怀,我有点恨透了它。但有些东西比其他东西更愚蠢、更难以理解,而这个看起来就是其中之一。
答案1
正如@DanielJ 的评论所述,您可以检查它是文件还是文件夹,例如,通过运行cd /mnt/public/
并查看您是否进入目录。
接下来,通过运行检查文件权限ls -lah /mnt/
。如果您可以发布该输出,我们可以确定 Samba 是否能够运行该文件夹。(编辑您的问题以显示输出)
奇怪的是,您有一个名为的用户吗public
?请检查您的tdbsam
(执行pdbedit -L public
)和/etc/passwd
文件(执行grep public /etc/passwd
)。如果该用户存在,它可能会尝试在检查其他共享定义之前查找该用户的主文件夹。
此外,在使用 Samba 时,要习惯运行testparm
和testparm -s
。前者检查所有命令和共享定义的语法,而后者显示和转储正在使用的当前配置。