无法使用密码 ssh 登录 - 未提供提示 - 身份验证失败次数过多

Rob*_*anu 6 opensuse sshd raspberry-pi

我正在尝试在 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.
Run Code Online (Sandbox Code Playgroud)

使用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
Run Code Online (Sandbox Code Playgroud)

我认为每次身份验证尝试都会计数并导致服务器停止与我通信。

果然,当我从不同的用户帐户登录时,出现密码提示。

在服务器上出现以下错误消息

Dec 09 20:27:18 linux sshd[1020]: error: maximum authentication attempts exceeded for root from 192.168.1.52 port 35088 ssh2 [preauth]
Run Code Online (Sandbox Code Playgroud)

要解决此问题,请尝试强制进行密码身份验证,如如何强制 ssh 客户端仅使用密码身份验证?:

ssh  -o PreferredAuthentications=password -o PubkeyAuthentication=no root@192.168.1.56
Run Code Online (Sandbox Code Playgroud)

现在导致

Permission denied (publickey,keyboard-interactive).
Run Code Online (Sandbox Code Playgroud)

在这种情况下如何才能使用基于密码的登录?

der*_*ert 5

“密码”和“键盘交互”是两种不同的身份验证类型;楼主提供的是后者。因此,您需要在首选身份验证列表中使用它:

\n\n
ssh -o PreferredAuthentications=keyboard-interactive \xe2\x80\xa6\n
Run Code Online (Sandbox Code Playgroud)\n

  • 请参阅 https://superuser.com/a/894625/180404 了解密码和键盘交互之间的区别 (2认同)