![无法使用密码 ssh 登录 - 未提供提示 - 身份验证失败次数过多](https://linux22.com/image/100615/%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%E5%AF%86%E7%A0%81%20ssh%20%E7%99%BB%E5%BD%95%20-%20%E6%9C%AA%E6%8F%90%E4%BE%9B%E6%8F%90%E7%A4%BA%20-%20%E8%BA%AB%E4%BB%BD%E9%AA%8C%E8%AF%81%E5%A4%B1%E8%B4%A5%E6%AC%A1%E6%95%B0%E8%BF%87%E5%A4%9A.png)
我正在尝试在 Raspberry Pi 上登录全新安装的 openSUSE Leap 42.2。该设置完全默认,并且 pi 上没有存储公钥。
当我尝试通过登录时出现错误:ssh [email protected]
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 [email protected]
现在导致
Permission denied (publickey,keyboard-interactive).
在这种情况下如何才能使用基于密码的登录?
答案1
“密码”和“键盘交互”是两种不同的身份验证类型;楼主提供的是后者。因此,您需要在首选身份验证列表中使用它:
ssh -o PreferredAuthentications=keyboard-interactive …