无法强制 Samba 使用 SMB2 或 SMB3

无法强制 Samba 使用 SMB2 或 SMB3

我有一台运行 smbd 的 Debian 服务器(Debian 9.3,samba 4.5.12)和一台 Ubuntu 17.10 客户端,我使用gio mount(以前的gvfs-mount)命令挂载 samba 共享:gio mount smb://server/storage

由于服务器和客户端都是最新的,我希望它们至少与 SMB3 或 SMB2 协商挂载,但如果我smbstatus在服务器上运行,挂载将使用 NT1(据我所知是 SMB1):

Samba version 4.5.12-Debian
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing              
----------------------------------------------------------------------------------------------------------------------------------------
12164   darren       darren       192.168.10.86 (ipv4:192.168.10.86:34052)  NT1               -                    -                    

Service      pid     Machine       Connected at                     Encryption   Signing     
---------------------------------------------------------------------------------------------
storage      12164   192.168.10.86 Thu Dec 21 22:49:30 2017 GMT     -            -           

No locked files

如果我添加client min protocol = SMB3到 smb.conf,我可以通过以下命令确认更改生效testparm -v | grep protocol

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[home]"
Processing section "[storage]"
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

client ipc max protocol = default
client ipc min protocol = default
client max protocol = default
client min protocol = SMB3
server max protocol = SMB3
server min protocol = LANMAN1

但是的输出smbstatus是一样的,挂载仍然使用 NT1(已卸载并重新挂载)。我如何强制命令gio mount使用较新的协议,为什么它默认不起作用?

这是我的 smb.conf:

[printers]
guest ok=yes
comment=Attached printers
browseable=no
printable=yes
path=/var/spool/samba
use client driver=yes

[global]
log file=/var/log/samba/log.all
guest account=nobody
load printers=yes
obey pam restrictions=yes
socket options=TCP_NODELAY IPTOS_LOWDELAY
interfaces=br0
map to guest=Bad User
show add printer wizard=no
encrypt passwords=true
passdb backend=tdbsam
unix extensions=no
dns proxy=no
wide links=yes
printing=cups
server string=%h Miniserver
invalid users=root
workgroup = sharefamily
printcap name=cups
#syslog=0
security=user
preferred master=yes
max log size=1000
disable spoolss=Yes
bind interfaces only=yes
client min protocol = SMB3

[home]
hide dotfiles=yes
browseable=yes
writable=yes
admin users=darren
path=/home
write list=darren
hide files=/lost+found/
guest ok=no
create mask=0764
directory mask=0775
comment=Home Directories
hide special files=yes
public=no

[storage]
browseable=yes
inherit owner=yes
inherit permissions=yes
admin users=darren
write list=darren
path=/home/storage
hide files=/lost+found/
guest ok=no
comment=Common storage
read only=yes
hide special files=yes
public=no

更新

我测试的另一个客户端(iPhone 应用程序)成功协商了 SMB2,因此这似乎是 gvfs 的限制。我发现这个相关问题这表明它仅限于 SMB1,以便能够按主机浏览网络。将尝试建议的解决方法并进行相应更新。

答案1

经过大量实验,在 ubuntu 16.04.x 中,这是解决方案。可与 Thunar、Nautilus、pcmanfm、Dolphin 文件管理器配合使用。

client max protocol = SMB3_10建议设置“ ”的修复方法/etc/samba/smb.conf也为我解决了这个问题。[1]

客户端 ubuntu 机器,除了服务器之外。这可能听起来很奇怪,但确实有效。[2]

Ubuntu 16.04 中的当前 Samba 版本默认建立 NT1 (SMB1) 连接,尽管它支持 SMB2 和 SMB3 - 因此当您从命令行指定客户端版本时,它会起作用。默认设置计划在 Samba 4.7(即将发布)中更改为 SMB3,并且已经在 LE 中执行此操作,因为我们将更改反向移植到我们的代码库的 Samba 4.6。您有两个选择:

a) 在 Ubuntu 中配置系统 smb.conf 以具有“客户端最小协议 = smb2”和“客户端最大协议 = smb3”,以便强制 smbclient 连接使用高于 NT1 的协议。那么您不需要手动指定协议版本。

  1. 来自 Debian 错误报告https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=883939

  2. https://forum.libreelec.tv/thread/9920-solved-8-1-1-samba-access-from-linux-protocol-negotiation-failed/

答案2

最小协议 = SMB2

不是

客户端最小协议 = SMB3

里面多了一个词。

相关内容