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

Mar*_*tin 6 ssh rsa private-key

我正在尝试使用位于 的私钥连接到远程 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).
Run Code Online (Sandbox Code Playgroud)

查看输出,似乎它甚至没有尝试我的私钥。我试过编辑 ~/.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
Run Code Online (Sandbox Code Playgroud)

dro*_*kie 4

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

debug1: Offering RSA public key: /home/martin/.ssh/id_rsa
debug1: Authentications that can continue: publickey
Run Code Online (Sandbox Code Playgroud)

但由于某种原因,远程服务器拒绝了它。无论您怎么想,都可以通过查看日志来确定原因。

  • 是的,但它们存储在不同的文件中。输出应指向“id_rsa.pub”。 (11认同)