xshell4连接ubuntu20.04失败,提示“找不到匹配的key exchange算法“ 以及 ubuntu 安装ssh

xshell4连接ubuntu20.04失败,提示“找不到匹配的key exchange算法“

 

对比ubuntu18.04,ubuntu20.04的key exchange算法
diffie-hellman-group14-sha1升级到了diffie-hellman-group14-sha256
xshell4版本估计不支持diffie-hellman-group14-sha256导致
在这里插入图片描述

解决方法:
增加ubuntu20.04 key excange算法diffie-hellman-group14-sha1,兼容xshell4

echo "KexAlgorithms +diffie-hellman-group14-sha1" >>/etc/ssh/sshd_config
systemctl restart sshd
##注意+号不能省略,+是追加算法

 

 

1:卸载openssh
sudo apt-get autoremove --purge openssh-server openssh-client

2:更新
sudo apt-get update

3:安装ssh服务端和客户端
sudo apt-get install openssh-server openssh-client

4:查看服务是否启动
ps -e|grep ssh

5:启动ssh
sudo service ssh start

6:若启动失败,了解错误原因
sshd -t

7:确认ssh-server已经正常工作
netstat -tlp

 

 

 

确定服务器可以上网
apt源配置完毕

安装ssh

使用apt安装openssh服务。

 
sudo  apt-get install   openssh-server

启动ssh

 
root@cka01:~# sudo /etc/init.d/ssh start
#确定22端口存在并存活
root@cka01:~# ss -tnl | grep 22 
LISTEN   0        128              0.0.0.0:22            0.0.0.0:*              
LISTEN   0        128                 [::]:22               [::]:* 

配置ssh root登录

编辑配置文件,让其支持root用户登录,因为默认是不支持root用户的。

 
sudo vim /etc/ssh/sshd_config

把其中的“PermitRootLogin prohibit-password” 修改为“PermitRootLogin yes”。


 

 
posted @ 2022-04-09 11:32  xiondun  阅读(3949)  评论(0编辑  收藏  举报