使用JSch访问Open欧拉22.03SP1报错com.jcraft.jsch.JSchException: Algorithm negotiation fail

在使用最新版的Jsch访问22.03SP1的操作系统的服务器报错算法不通过,已将客户端和服务端的算法统一,但是仍旧无法连接,有无大佬知道

怎么解决的呢

社区大佬帮忙解决的,提供参考

打开/etc/ssh/sshd_config文件,在HostKeyAlgorithms和PubkeyAcceptedKeyTypes配置项增加ssh-rsa

# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.20230427
# grep -vE '^#|^$' /etc/ssh/sshd_config
# vi /etc/ssh/sshd_config
HostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512
PubkeyAcceptedKeyTypes ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512
在HostKeyAlgorithms和PubkeyAcceptedKeyTypes配置项增加ssh-rsa
HostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512,ssh-rsa
PubkeyAcceptedKeyTypes ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512,ssh-rsa

# systemctl restart sshd
# systemctl status sshd
1 Like