centos7.2升级openssh7.9p1

时间:2019-11-12
本文章向大家介绍centos7.2升级openssh7.9p1,主要包括centos7.2升级openssh7.9p1使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Centos7.2版本yum升级openssh版本最高到7.4,想要升级到更高的版本需要重新编译

一、查看当前openssh版本:

[root@localhost ~]# ssh -V
OpenSSH_6.6p1, OpenSSL 1.0.0-fips 29 Mar 2010

二、编译openssh7.9p1

1、卸载旧的openssh

# rpm -e --nodeps `rpm -qa | grep openssh`

2、编译安装新版本openssh7.9p1

下载软件包

wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz

解压编译

# tar -xvf openssh-7.9p1.tar.gz

# cd openssh-7.9p1

# ./configure --prefix=/usr --sysconfdir=/etc/ssh

# make & make install

3、配置并启动sshd服务

# cp openssh-7.9p1/contrib/redhat/sshd.init /etc/init.d/sshd

# chkconfig --add sshd

修改配置文件:# vim /etc/ssh/sshd_config

PermitRootLogin no

重启服务

# service sshd restart

4、检查版本信息:

# ssh -V
OpenSSH_7.9p1, OpenSSL 1.0.1e-fips 11 Feb 2013

5、编译报错信息集合

(1)#./configure --prefix=/usr --sysconfdir=/etc/ssh

configure: error: *** zlib.h missing - please install first or check config.log ***

解决方法:# yum install -y zlib-devel

(2)#./configure --prefix=/usr --sysconfdir=/etc/ssh

configure: error: *** OpenSSL headers missing - please install firstorcheck config.log

解决方法:# yum install -y openssl-devel

(3)# make install

ssh-keygen: generating new host keys: DSA 
/usr/sbin/sshd -t -f /etc/ssh/sshd_config
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0640 for '/etc/ssh/ssh_host_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Error loading host key "/etc/ssh/ssh_host_rsa_key": bad permissions
Could not load host key: /etc/ssh/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0640 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Error loading host key "/etc/ssh/ssh_host_ecdsa_key": bad permissions
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0640 for '/etc/ssh/ssh_host_ed25519_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Error loading host key "/etc/ssh/ssh_host_ed25519_key": bad permissions
Could not load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.
make: [check-config] Error 1 (ignored)

解决方法:# rm -rf /etc/ssh/ssh_host_*

                  # make install

参考文献:http://blog.51cto.com/sf1314/2150313

原文地址:https://www.cnblogs.com/carriezhangyan/p/11840940.html