您尚未登录。

#1 2021-10-08 16:32:02

Tamako
会员
注册时间: 2019-02-18
帖子: 23

SSH 密钥认证失败

之前一直是正常的,今天更新系统后报错。

▶ ssh -vT git@codeup.aliyun.com         
OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to codeup.aliyun.com [118.31.165.50] port 22.
debug1: Connection established.
debug1: identity file /home/myname/.ssh/id_rsa type 0
debug1: identity file /home/myname/.ssh/id_rsa-cert type -1
debug1: identity file /home/myname/.ssh/id_dsa type -1
debug1: identity file /home/myname/.ssh/id_dsa-cert type -1
debug1: identity file /home/myname/.ssh/id_ecdsa type -1
debug1: identity file /home/myname/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/myname/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/myname/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/myname/.ssh/id_ed25519 type -1
debug1: identity file /home/myname/.ssh/id_ed25519-cert type -1
debug1: identity file /home/myname/.ssh/id_ed25519_sk type -1
debug1: identity file /home/myname/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/myname/.ssh/id_xmss type -1
debug1: identity file /home/myname/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.8
debug1: Remote protocol version 2.0, remote software version Go
debug1: compat_banner: no match: Go
debug1: Authenticating to codeup.aliyun.com:22 as 'git'
debug1: load_hostkeys: fopen /home/myname/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: (no match)
Unable to negotiate with 118.31.165.50 port 22: no matching host key type found. Their offer: ssh-rsa

于是在 .ssh 下加了一个 config 文件,内容如下

Host *
    HostKeyAlgorithms +ssh-rsa
    UserKnownHostsFile ~/.ssh/known_hosts
    IdentityFile ~/.ssh/id_rsa

依然报错

▶ ssh -vT git@codeup.aliyun.com
OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021
debug1: Reading configuration data /home/myname/.ssh/config
debug1: /home/myname/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to codeup.aliyun.com [118.31.165.50] port 22.
debug1: Connection established.
debug1: identity file /home/myname/.ssh/id_rsa type 0
debug1: identity file /home/myname/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.8
debug1: Remote protocol version 2.0, remote software version Go
debug1: compat_banner: no match: Go
debug1: Authenticating to codeup.aliyun.com:22 as 'git'
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa SHA256:yEGmgQNVrc3QAvDvoBr*****
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'codeup.aliyun.com' is known and matches the RSA host key.
debug1: Found key in /home/myname/.ssh/known_hosts:6
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/myname/.ssh/id_rsa RSA SHA256:Gphrjht1z9gNF8q***** explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/myname/.ssh/id_rsa RSA SHA256:Gphrjht1z9gNF8q***** explicit
debug1: send_pubkey_test: no mutual signature algorithm
debug1: No more authentication methods to try.
git@codeup.aliyun.com: Permission denied (publickey).

看起来像是跟公钥有关,但是我不知道怎么改了。

离线

#2 2021-10-08 17:16:46

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 6,672
个人网站

Re: SSH 密钥认证失败

PubkeyAcceptedKeyTypes +ssh-rsa

离线

#3 2021-10-08 17:32:34

Tamako
会员
注册时间: 2019-02-18
帖子: 23

Re: SSH 密钥认证失败

依云 说:

PubkeyAcceptedKeyTypes +ssh-rsa

可以了,谢谢~

离线

#4 2021-11-01 20:36:04

远的七里香
会员
注册时间: 2021-11-01
帖子: 3

Re: SSH 密钥认证失败

大佬,怎么解决的,我有个类似的问题,提示是这样的:
sign_and_send_pubkey: no mutual signature supported
root@10.12.107.97: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

离线

页脚