Ubuntu 20.04“沒有為使用者設定 LanMan 密碼”

Ubuntu 20.04“沒有為使用者設定 LanMan 密碼”

我的設定:帶有 Ubuntu 20.04 的伺服器和 samba 共用。 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 預設為關閉它。

您可以透過編輯 smb.conf 在 Ubuntu 20 中啟用它,並在 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 的建議解決了它。

但我還有兩件事要考慮:

  1. 設定與之前相同的密碼不會重置雜湊值。
  2. 密碼最大長度為 14 個字元。對於較長的密碼,將不會設定雜湊值。

可以使用以下命令檢查哈希值

pdbedit -L -w

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 代表未設定。

相關內容