openSSH升级常见报错汇总

openSSH升级(常见报错)

 

目录

1:编译安装gcc

2:升级openSSL

3: openssl-devel安装

4:安装pam-devel

5:sshd未识别的服务

6: Linux每次重启xshell拒绝连接(已经开通root)

7: centos7升级openssh,启动ssh服务失败

8: checking OpenSSL library version... configure: error: OpenSSL >= 1.0.1 required (have "10000003 (OpenSSL 1.0.0-fips 29 Mar 2010)")

9: key exchange failed

1: bug截图

2:原因分析

3:解决方法

下面的解决方式,请详见我的博客,该文章只是主要针对报错给我的解决方案

https://blog.csdn.net/qq_26963433/article/details/108496965

1:编译安装gcc

openSSH升级常见报错汇总

 

这是因为你的centos没有安装gcc,你是需要安装gcc的

进入安装目录  

cd  /tools/openSSH/gcc

rpm  -ivh  *.rpm --nodeps --force

 

2:升级openSSL

openSSH升级常见报错汇总

 

发现还有错误,这是因为升级openSSH的同时需要先升级openSSL

 

3: openssl-devel安装

openSSH升级常见报错汇总

 

   还有可能会包"OpenSSL headers missing - please install first or check config.log ***"的错误,这是缺少openssl-devel所致,只需安装openssl-devel即可,执行命令:yum install openssl-devel

 

4:安装pam-devel

openSSH升级常见报错汇总

 

提示你需要安装pam-devel

 

5:sshd未识别的服务

service sshd restart 启动后报错:为什么会报这个错哩,这是因为之前的Linux自带的openSSH卸载掉了

rpm -qa|grep openssh

openSSH升级常见报错汇总

 

依次卸载里面的安装包

rpm -e --nodeps openssh-server-5.3p1-94.el6.x86_64

yum remove openssh -y

openSSH升级常见报错汇总

 

 

https://www.cnblogs.com/nmap/p/10779658.html

如果不拷贝,将会报sshd:未识别的服务这个错误,如果目录之前就存在,直接覆盖就好了

进入安装目录后 cd /training/openssh-8.0p1/

cp -a contrib/redhat/sshd.init /etc/init.d/sshd

cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

chmod +x /etc/init.d/sshd

chkconfig --add sshd

 

然后再执行

service sshd restart

openSSH升级常见报错汇总

 

 

6: Linux每次重启xshell拒绝连接(已经开通root)

我升级完openssh后也遇到了这个问题,每次虚拟机重启都要使用Telnet登录重启一次sshd服务才能连接。

openSSH升级常见报错汇总

 

原因分析

卸载之前

openSSH升级常见报错汇总

 

卸载之后

yum remove openssh -y

openSSH升级常见报错汇总

 

得出结论,不能卸载,因为重装后,并没有相关的openssh的服务端和客户端的安装包了,在centos7之前的版本是没有对应openssh8.0更新版本对应的服务端和客户端的安装包的

没有下面两个安装包

http://www.rpmfind.net/linux/rpm2html/search.php?query=openssh-server(x86-64)

openssh-server-8.0p1

openssh-clients-8.0p1

openSSH升级常见报错汇总

 

7: centos7升级openssh,启动ssh服务失败

编译安装时候

openSSH升级常见报错汇总

 

Starting sshd (via systemctl): Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.

[失败]

 

查看启动状态

 

systemctl status sshd.service

openSSH升级常见报错汇总

 

如果不授权,会报如下错误哦,会导致启动失败

  chmod 600 /etc/ssh/ssh_host_rsa_key

  chmod 600 /etc/ssh/ssh_host_ecdsa_key

 

 

8: 编译指令错误

checking OpenSSL library version... configure: error: OpenSSL >= 1.0.1 required (have "10000003 (OpenSSL 1.0.0-fips 29 Mar 2010)")

openSSH升级常见报错汇总

 

问题原因:

centos6.5使用的openSSH编译安装指令不对

错误指令

./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-zlib --with-md5-passwords --with-pam && make install

 

正确指令

./configure --prefix=/usr/ --sysconfdir=/etc/ssh  --with-openssl-includes=/usr/local/ssl/include \

 --with-ssl-dir=/usr/local/ssl   --with-zlib   --with-md5-passwords   --with-pam  && make && make install

 

 

 

9: key exchange failed

1: bug截图

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

 

openSSH升级常见报错汇总

 

openSSH升级常见报错汇总

2:原因分析

升级高版本的openSSH后,新版本不支持老版本的**交换算法

3:解决方法

修改 /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