SSH:为什么我的系统在尝试公钥身份验证时提供我的私钥?

SSH:为什么我的系统在尝试公钥身份验证时提供我的私钥?

正在尝试连接到服务器。我收到了一个用于登录该服务器的私钥,并将其添加到 id_rsa.然而,客户端不断尝试将其作为公钥而不是 id_rsa.pub 传递。这是因为 id_rsa.pub 不在我的 ssh_config 文件中吗?

服务器连接尝试

debug1: Offering RSA public key: /root/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51

SSH 配置文件(身份部分)

root@etoorlan4c:~/.ssh# cat /etc/ssh/ssh_config
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa

~/.ssh/ 的内容

root@etoorlan4c:~/.ssh# ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts

答案1

私钥无效。其中缺少一个字符。当使用有效的私钥时,输出将发生如下变化:

debug1: Offering RSA public key: root@etoorlan4c
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: sshkey.private
debug3: sign_and_send_pubkey: RSA SHA256:jmMyCOppv3KKkRgiHI4s5h3I7LwyCgms8uSG06KClQ4
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to [remoteHost]([xxx.xxx.xxx.xxx]:22).

相关内容