ssh - 为什么不尝试我的私钥?

ssh - 为什么不尝试我的私钥?

我正在尝试使用 上的私钥连接到远程 SSH 服务器~/.ssh/id_rsa。当我ssh -v连接到服务器时,我收到以下信息:

...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/martin/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: martin@martin
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/martin/.ssh/id_dsa
debug1: Trying private key: /home/martin/.ssh/id_ecdsa
debug1: Trying private key: /home/martin/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

查看输出,似乎它甚至没有尝试我的私钥。我尝试编辑 ~/.ssh/config、使用选项-i、通过 添加密钥ssh-add,但都不起作用。

我确信公钥已正确安装在远程服务器上。有人能帮助我吗?

编辑:

martin@martin:~/.ssh$ ls -la
total 20
drwx------  2 martin martin 4096 feb 26 09:44 .
drwxr-xr-x 41 martin martin 4096 feb 26 09:37 ..
-rw-------  1 martin martin 1766 feb 25 16:31 id_rsa
-rw-r--r--  1 martin martin  409 feb 25 16:31 id_rsa.pub
-rw-r--r--  1 martin martin  540 feb 26 09:46 known_hosts

答案1

你的 ssh 客户端肯定会向远程 ssh 提供你的 RSA 密钥:

debug1: Offering RSA public key: /home/martin/.ssh/id_rsa
debug1: Authentications that can continue: publickey

但出于某种原因,远程服务器拒绝了它。不管你怎么想,都可以通过查看它的日志来确定原因。

相关内容