ssh 密钥密码错误但正确

use*_*864 2 ssh ssh-keys

我无法使用 ssh id_rsa/id_rsa.pub 密钥,因为看起来 ssh 认为输入的密码是错误的。但我确信这是对的。它看起来是这样的:

ssh myuser@myhost_ip -i ~/.ssh/id_rsa.pub 
The authenticity of host 'myhost_ip (myhost_ip)' can't be established.
RSA key fingerprint is SHA256: (some hash).
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'myhost_ip' (RSA) to the list of known hosts.
Enter passphrase for key '/Users/paul/.ssh/id_rsa.pub': 
Enter passphrase for key '/Users/paul/.ssh/id_rsa.pub': 
Enter passphrase for key '/Users/paul/.ssh/id_rsa.pub': 
Run Code Online (Sandbox Code Playgroud)

据我了解,它认为密码是错误的。在这个问题之前,我还有另一个问题(我不确定,但也许它们是相关的?):

Permissions 0644 for '/Users/paul/.ssh/id_rsa.pub' are too open.
Run Code Online (Sandbox Code Playgroud)

我用 修复了它chmod 400 ~/.ssh/id_rsa.pub。我不确定为什么会出现这个问题,我猜测这些密钥是在 Ubuntu 上生成并转移到 MacOS 上的。

所以问题是:为什么 ssh 不接受我的密码以及如何修复它?

EEA*_*EAA 6

公钥没有密码。私钥可以。

您错误地尝试使用您的公钥作为您的身份,这永远不会起作用。使用您的私钥。