Ubuntu Samba 树连接失败:NT_STATUS_BAD_NETWORK_NAME

Ubuntu Samba 树连接失败:NT_STATUS_BAD_NETWORK_NAME

我被难住了。几个小时后,我还没有取得任何进展。我收到以下错误。运行 Ubuntu 22.04。疯狂的是,我在另一台运行相同版本的机器上也可以运行。我只是不知道我现在做错了什么。我尝试了多个 Ubuntu 实例,但遇到了同样的问题。我最初以为是因为共享在第二个硬盘上,但我通过卸载它并共享同一操作系统驱动器上的文件夹解决了这个问题,但仍然收到相同的错误。

树连接失败:NT_STATUS_BAD_NETWORK_NAME

这是在使用来自其他 Ubuntu 实例和 Windows 的 smbclient 时发生的。

smbclient //titan/share -U samba
Password for [WORKGROUP\samba]:
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

这是我的 smb.conf。

[global]
   workgroup = WORKGROUP

   server string = %h server (Samba, Ubuntu)
   log file = /var/log/samba/log.%m
   max log size = 1000
   logging = file

   server role = standalone server

   obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<[email protected]> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
   pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user

[share]
  comment = share
  browsable = yes
  read only = no
  path = /home/samba
  create mask = 775
  directory = 775
  valid users = samba

整个路径的权限均为 777。SELinux 未参与其中,AppArmor 未针对 samba 设置配置文件。

答案1

在您的配置中,您已将共享指定为\\titan\share,这也是您应该访问它的方式,而不是\\titan\samba

答案2

如果您正在使用(强制执行)SElinux,Samba 对这些位置的访问可能会被拒绝,除非:

semanage fcontext -a -t share "/home/samba(/.*)?"

restorecon -Rv /home/samba

还要检查防火墙或被阻止的端口

并重新启动 samba 服务并检查其状态

相关内容