Alibaba Cloud Service Area ECS, after applying for a free server, how to use xshell to log in, but the matching host key algorithm cannot be found

Table of contents

1 question

After receiving the server for free from Alibaba Cloud, I cannot log in using xshell, prompting

No matching host key algorithm found
or
no matching keyexchange algorithm found.

How to solve

2 solve

The server-side configuration file: /etc/ssh/sshd_config

# 在行尾增加",ecdh-sha2-nistp521",以满足ecdsa公钥方式登录(密钥长度521)
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp521

# 在行尾增加",ssh-rsa",以满足RSA 登录
HostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512,ssh-rsa

# 在行尾增加",ssh-rsa",以满足RSA 登录
PubkeyAcceptedKeyTypes ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512,ssh-rsa

Insert image description here
Save systemctl restart ssh.

Guess you like

Origin blog.csdn.net/python113/article/details/132344883