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).

相關內容