Opensuse

無法使用密碼進行 ssh 登錄 - 未提供提示 - 身份驗證失敗次數過多

  • December 9, 2016

我正在嘗試在 Raspberry Pi 上登錄全新安裝的 openSUSE Leap 42.2。如果完全預設設置,並且 pi 上沒有儲存公鑰。

當我嘗試通過ssh root@192.168.1.56我登錄時出現錯誤:

Received disconnect from 192.168.1.56 port 22:2: Too many authentication failures
Connection to 192.168.1.56 closed by remote host.
Connection to 192.168.1.56 closed.

使用ssh -v表明提供了許多公鑰:

debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/robert/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering DSA public key: /home/robert/.ssh/id_dsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering RSA public key: robert@XXX
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering RSA public key: robert@yyy
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering RSA public key: robert@zzz
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering RSA public key: backup-login@xxx

我假設每個身份驗證嘗試都算在內,並導致伺服器停止與我交談。

果然,當我從不同的使用者帳戶登錄時,出現密碼提示。

在伺服器上出現以下錯誤消息

Dec 09 20:27:18 linux sshd[1020]: error: maximum authentication attempts exceeded for root from 192.168.1.52 port 35088 ssh2 [preauth]

要解決此問題,請嘗試強制密碼身份驗證,如如何強制 ssh 客戶端僅使用密碼身份驗證中所述?

ssh  -o PreferredAuthentications=password -o PubkeyAuthentication=no root@192.168.1.56

現在導致

Permission denied (publickey,keyboard-interactive).

在這種情況下如何讓基於密碼的登錄工作?

“密碼”和“鍵盤互動”是兩種不同的身份驗證類型;主人提供後者。因此,您需要在首選身份驗證列表中使用它:

ssh -o PreferredAuthentications=keyboard-interactive …

引用自:https://unix.stackexchange.com/questions/329324