我的设置:带有 samba 共享的 Ubuntu 20.04 服务器。HP Deskjet 8620 Pro 打印机。
打印机提供了一项名为“扫描到网络文件夹”的功能。它以前可以与 Ubuntu 16.04 配合使用,但自从更新后就无法使用了。通过谷歌搜索,我发现这台打印机使用的是非常旧的 smb 协议版本。
我发现这建议设置的帖子
[global]
ntlm auth = yes
lanman auth = yes
在 smb.conf 中。
添加这两行后,我重新启动了 samba 并更改了相应 smb 用户的密码:
sudo systemctl restart smbd.server nmbd.service
sudo smbpasswd hpscanner
Samba 调试日志仍然告诉我“没有为用户 hpscanner 设置 LanMan 密码”:
[2021/06/06 19:37:36.401815, 3] ../../source3/auth/auth.c:199(auth_check_ntlm_password)
check_ntlm_password: Checking password for unmapped user [SERVER]\[hpscanner]@[WORKSTATION] with the new password interface
[2021/06/06 19:37:36.401828, 3] ../../source3/auth/auth.c:202(auth_check_ntlm_password)
check_ntlm_password: mapped user is: [SERVER]\[hpscanner]@[WORKSTATION]
[2021/06/06 19:37:36.402019, 3] ../../source3/passdb/lookup_sid.c:1684(get_primary_group_sid)
Forcing Primary Group to 'Domain Users' for hpscanner
[2021/06/06 19:37:36.402147, 3] ../../libcli/auth/ntlm_check.c:403(ntlm_password_check)
ntlm_password_check: NTLMv2 password check failed
[2021/06/06 19:37:36.402163, 3] ../../libcli/auth/ntlm_check.c:451(ntlm_password_check)
ntlm_password_check: NO LanMan password set for user hpscanner (and no NT password supplied)
[2021/06/06 19:37:36.402215, 3] ../../libcli/auth/ntlm_check.c:593(ntlm_password_check)
ntlm_password_check: LM password, NT MD4 password in LM field and LMv2 failed for user hpscanner
[2021/06/06 19:37:36.402394, 2] ../../source3/auth/auth.c:343(auth_check_ntlm_password)
check_ntlm_password: Authentication for user [hpscanner] -> [hpscanner] FAILED with error NT_STATUS_WRONG_PASSWORD, authoritative=1
supplied)
那么如何正确设置LanMan密码呢?
我可以将 Samba 配置为仅为这一个用户接受这个旧的身份验证吗?
谢谢!
编辑:
我添加了
server min protocol = NT1
正如答案中所建议的那样。这并没有改变任何事情。
日志:
[2021/08/05 19:51:46.005653, 3] ../../source3/auth/auth.c:199(auth_check_ntlm_password)
check_ntlm_password: Checking password for unmapped user [SERVER]\[hpscanner]@[WORKSTATION] with the new password interface
[2021/08/05 19:51:46.005665, 3] ../../source3/auth/auth.c:202(auth_check_ntlm_password)
check_ntlm_password: mapped user is: [SERVER]\[hpscanner]@[WORKSTATION]
[2021/08/05 19:51:46.005848, 3] ../../source3/passdb/lookup_sid.c:1684(get_primary_group_sid)
Forcing Primary Group to 'Domain Users' for hpscanner
[2021/08/05 19:51:46.005967, 3] ../../libcli/auth/ntlm_check.c:403(ntlm_password_check)
ntlm_password_check: NTLMv2 password check failed
[2021/08/05 19:51:46.005982, 3] ../../libcli/auth/ntlm_check.c:451(ntlm_password_check)
ntlm_password_check: NO LanMan password set for user hpscanner (and no NT password supplied)
[2021/08/05 19:51:46.006036, 3] ../../libcli/auth/ntlm_check.c:593(ntlm_password_check)
ntlm_password_check: LM password, NT MD4 password in LM field and LMv2 failed for user hpscanner
[2021/08/05 19:51:46.006198, 2] ../../source3/auth/auth.c:343(auth_check_ntlm_password)
check_ntlm_password: Authentication for user [hpscanner] -> [hpscanner] FAILED with error NT_STATUS_WRONG_PASSWORD, authoritative=1
[2021/08/05 19:51:46.006239, 2] ../../auth/auth_log.c:635(log_authentication_event_human_readable)
Auth: [SMB,(null)] user [SERVER]\[hpscanner] at [Thu, 05 Aug 2021 19:51:46.006227 UTC] with [NTLMv2] status [NT_STATUS_WRONG_PASSWORD] workstation [WORKSTATION] remote host [ipv4:10.0.0.210:1024] mapped to [SERVER]\[hpscanner]. local host [ipv4:10.0.0.200:445]
{"timestamp": "2021-08-05T19:51:46.006293+0000", "type": "Authentication", "Authentication": {"version": {"major": 1, "minor": 2}, "eventId": 4625, "logonId": "0", "logonType": 3, "status": "NT_STATUS_WRONG_PASSWORD", "localAddress": "ipv4:10.0.0.200:445", "remoteAddress": "ipv4:10.0.0.210:1024", "serviceDescription": "SMB", "authDescription": null, "clientDomain": "SERVER", "clientAccount": "hpscanner", "workstation": "WORKSTATION", "becameAccount": null, "becameDomain": null, "becameSid": null, "mappedAccount": "hpscanner", "mappedDomain": "SERVER", "netlogonComputer": null, "netlogonTrustAccount": null, "netlogonNegotiateFlags": "0x00000000", "netlogonSecureChannelType": 0, "netlogonTrustAccountSid": null, "passwordType": "NTLMv2", "duration": 5104}}
[2021/08/05 19:51:46.006332, 3] ../../auth/gensec/spnego.c:1442(gensec_spnego_server_negTokenTarg_step)
gensec_spnego_server_negTokenTarg_step: SPNEGO(ntlmssp) login failed: NT_STATUS_WRONG_PASSWORD
[2021/08/05 19:51:46.006368, 3] ../../source3/smbd/error.c:78(error_packet_set)
NT error packet at ../../source3/smbd/sesssetup.c(246) cmd=115 (SMBsesssetupX) NT_STATUS_LOGON_FAILURE
[2021/08/05 19:51:46.007110, 3] ../../source3/smbd/server_exit.c:243(exit_server_common)
Server exit (failed to receive smb request)
有任何想法吗?
答案1
我想你已经快到了。
您的 HP 打印机正在尝试使用 smb 的 SMB1(Samba 称之为 NT1)方言连接到 Ubuntu 服务器。在 Ubuntu 16 或 18 中这不是问题。在 Ubuntu 20 中,Samba 默认将其关闭。
您可以在 Ubuntu 20 中通过编辑 smb.conf 来启用它,并在 workgroup = WORKGROUP 行下添加以下内容:
server min protocol = NT1
您可以尝试重新启动 smbd sudo service smbd restart
,但可能只需要重新启动即可。
答案2
终于解决了:
[global]
server min protocol = NT1
ntlm auth = yes
lanman auth = yes
并设置新的密码
sudo smbpasswd username
按照 Morbius1 的建议解决了这个问题。
但我还需要考虑两件事:
- 设置与之前相同的密码不会重置哈希。
- 密码的最大长度为 14 个字符。如果密码过长,则不会设置哈希值。
可以使用以下方法检查哈希值
pdbedit -L -w
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX代表未设置。