新安装的Ubuntu20.04,SSH服务已安装,使用putty可以正常ssh远程登录进去,使用SecureCRT远程登录会报错如下:Key exchange failed. No compatible key exchange method. The server supports these methods: curve25519-sha256,
[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
解决办法:
1)在/etc/ssh/sshd_config文件中添加
KexAlgorithms
[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
2)fedora 34 还需要注释掉 #Include /etc/ssh/sshd_config.d/*.conf
# cat /etc/crypto-policies/back-ends/opensshserver.config
Ciphers
[email protected],
[email protected],aes256-ctr,
[email protected],aes128-ctr
MACs
[email protected],
[email protected],
[email protected],
[email protected],hmac-sha2-256,hmac-sha1,
[email protected],hmac-sha2-512
GSSAPIKexAlgorithms gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-
KexAlgorithms curve25519-sha256,
[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
HostKeyAlgorithms ecdsa-sha2-nistp256,
[email protected],
[email protected],
[email protected],ecdsa-sha2-nistp384,
[email protected],ecdsa-sha2-nistp521,
[email protected],ssh-ed25519,
[email protected],
[email protected],
[email protected],rsa-sha2-256,
[email protected],rsa-sha2-512,
[email protected]
PubkeyAcceptedKeyTypes ecdsa-sha2-nistp256,
[email protected],
[email protected],
[email protected],ecdsa-sha2-nistp384,
[email protected],ecdsa-sha2-nistp521,
[email protected],ssh-ed25519,
[email protected],
[email protected],
[email protected],rsa-sha2-256,
[email protected],rsa-sha2-512,
[email protected]
CASignatureAlgorithms ecdsa-sha2-nistp256,
[email protected],ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,
[email protected],rsa-sha2-256,rsa-sha2-512
重启sshd生效:
systemctl restart sshd
Ciphers
[email protected],
[email protected],
[email protected],aes256-ctr,aes192-ctr,aes128-ctr
MACs
[email protected],
[email protected],
[email protected],hmac-sha2-512,hmac-sha2-256,
[email protected]
参考:
https://stribika.github.io/2015/01/04/secure-secure-shell.html
[
本帖最后由 linda 于 2021-7-19 19:35 编辑 ]