修改 /etc/ssh/sshd_config,在最后添加一行

echo "KexAlgorithms +diffie-hellman-group-exchange-sha256,diffie-hellman-group1-sha1"  >> /etc/ssh/sshd_config
systemctl restart sshd