SSH升级到7.7

#!/bin/bash
#删除旧版ssh包 危险操作,不删除也可以安装,建议跳过此操作。
#rpm -e `rpm -qa | grep openssh`

#安装zlib依赖包
wget -c http://zlib.net/zlib-1.2.11.tar.gz

tar zxvf zlib-1.2.11.tar.gz

cd zlib-1.2.11

./configure --prefix=/usr/local/zlib && make && make install

#安装pam-devel依赖包

yum -y install pam-devel

#安装ssl依赖包

wget -c https://www.openssl.org/source/openssl-1.1.1a.tar.gz

tar zxvf openssl-1.1.1a.tar.gz


cd openssl-1.1.1a

./config --prefix=/usr/local/openssl && make && make install


#安装ssh包

wget -c http://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/openssh-7.7p1.tar.gz

tar zxvf openssh-7.7p1.tar.gz

cd openssh-7.7p1

./configure --prefix=/usr/local/openssh --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/usr/local/openssh/etc --with-ssl-dir=/usr/local/openssl/bin --with-zlib=/usr/local/zlib --with-md5-passwords  && make && make install

 

error: *** zlib.h missing - please install first or check config.log ***
"这是由于缺少zlib-devel所致,只需安装zlib-devel即可,执行命令:yum install zlib-devel
OpenSSL headers missing - please install first or check config.log ***"的错误,
这是缺少openssl-devel所致,只需安装openssl-devel即可,执行命令:yum install openssl-devel

作者:songzhusheren 来源:CSDN 原文:https://blog.csdn.net/songzhusheren/article/details/53167008 版权声明:本文为博主原创文章,转载请附上博文链接!

 



\cp -p /etc/init.d/sshd /etc/init.d/sshd.lod_$(date +%Y-%m-%d_%H-%M)

\cp -p contrib/redhat/sshd.init /etc/init.d/sshd

chmod u+x /etc/init.d/sshd

#新安装的ssh的配置目录在/usr/local/openssh/etc 下,这款一定注意
/usr/sbin/sshd -t -f /usr/local/openssh/etc/sshd_config  #测试配置文件有效性


#添加开机启动项
chkconfig --add sshd

chkconfig sshd on

/etc/init.d/sshd restart


#错误处理:当报出 openssl 错误是需要 yum -y install openssl-devel

 

SSH升级后,root用户无法登陆的问题:

修改配置文件/etc/ssh/sshd_config,添加下面的设置

PermitRootLogin yes

posted on 2017-07-06 16:21  天涯尘星  阅读(1252)  评论(0编辑  收藏  举报

导航