openssh6.8升级方案V2.0

更新时间:2023-10-31 17:16:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

openssh6.8升级参考指南(仅供参考,请自行测试)

务必开启telnet防止登不上

系统信息如下:

系统版本:Red Hat Enterprise Linux Server release 6.5 (Santiago) 64位

openssl和openssh版本OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010

1.升级所需要的安装包

不同的环境需要不同的安装包,此次安装需要安装包如下 GCC环境所需的安装包: ppl-0.10.2-11.el6.x86_64.rpm cloog-ppl-0.15.7-1.2.el6.x86_64.rpm mpfr-2.4.1-6.el6.x86_64.rpm cpp-4.4.7-4.el6.x86_64.rpm gcc-4.4.7-4.el6.x86_64.rpm 编译安装openssl和openssh所需的安装包 zlib-devel-1.2.3-29.el6.x86_64.rpm pam-devel-1.1.1-17.el6.x86_64.rpm OpenSSH 升级所需安装包: openssl-1.0.0s.tar.gz

openssh-6.8p1.tar.gz 2.升级相关步骤

2.1安装GCC环境所需的安装包和相关软件包

[root@localhost opt]# rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm [root@localhost opt]# rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm [root@localhost opt]# rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm [root@localhost opt]# rpm -ivh cpp-4.4.7-4.el6.x86_64.rpm [root@localhost opt]# rpm -ivh gcc-4.4.7-4.el6.x86_64.rpm [root@localhost opt]# rpm -ivh zlib-devel-1.2.3-29.el6.x86_64.rpm [root@localhost opt]# rpm -ivh pam-devel-1.1.1-17.el6.x86_64.rpm 2.2卸载系统自带的openssh,同时清除系统/etc/ssh目录

备份openssh的配置文件

[root@localhost opt]#cp -r /etc/ssh /etc/ssh_bak

[root@localhost opt]# cp/etc/init.d/sshd /etc/init.d/sshd_bak [root@localhost opt]#cp/usr/sbin/sshd /usr/sbin/sshd_bak

[root@localhost opt]# rpm -qa | grepopenssh openssh-5.3p1-94.el6.x86_64 openssh-clients-5.3p1-94.el6.x86_64 openssh-server-5.3p1-94.el6.x86_64 openssh-askpass-5.3p1-94.el6.x86_64 [root@localhost opt]# rpm -e openssh-server [root@localhost opt]# rpm -e openssh-askpass [root@localhost opt]# rpm -e openssh-clients --nodeps [root@localhost opt]# rpm -e openssh [root@localhost ~]# rm -rf /etc/ssh 2.3 安装openssl [root@localhost opt]# tar -zxvf openssl-1.0.0s.tar.gz [root@localhost opt]# cd openssl-1.0.0s

[root@localhost openssl-1.0.0s]# ./config --prefix=/usr/local/openssl&& make && make install 2.4安装openssh

[root@localhost openssl-1.0.0s]# cd /opt

[root@localhost opt]# tar -zxvf openssh-6.8p1.tar.gz

[root@localhost opt]# cd openssh-6.8p1

[root@localhost openssh-6.8p1]# ./configure --prefix=/usr/local/openssh

--sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/zlib --with-md5-passwords --without-hardening && make && make install 2.5修改配置文件

[root@localhost openssh-6.8p1]# cpcontrib/redhat/sshd.init/etc/init.d/sshd [root@localhost openssh-6.8p1]# chmod +x /etc/init.d/sshd [root@localhost openssh-6.8p1]# vi /etc/init.d/sshd 修改对应指令的安装目录 =============================

25行 SSHD=/usr/sbin/sshd 为 SSHD=/usr/local/openssh/sbin/sshd 41行 /usr/bin/ssh-keygen -A 为 /usr/local/openssh/bin/ssh-keygen -A ============================= 保存退出

2.6加入系统服务

[root@localhost openssh-6.8p1]# chkconfig --add sshd [root@localhost openssh-6.8p1]# service sshdstart [root@localhost openssh-6.8p1]# service sshd restart

断开重连可以登录 Xshell:\\>ssh 192.168.138.128 Connecting to 192.168.138.128:22... Connection established.

To escape to local shell, press 'Ctrl+Alt+]'. Last login: Tue Nov 3 05:51:34 2015 from 192.168.138.1 [root@localhost ~]# 2.7查看升级后的系统版本 [root@localhost ~]# ssh -V

OpenSSH_6.8p1, OpenSSL 1.0.0s 11 Jun 2015

三:失败回退 3.1备份目录回退

[root@localhost ~]# service sshd stop Stopping sshd: [ OK ]

[root@localhost ~]# cd /etc [root@localhostetc]# rm -rfssh

[root@localhostetc]# cp -r /etc/ssh_bak /etc/ssh/ [root@localhostetc]# cd /etc/init.d [root@localhostinit.d]#rmsshd rm: remove regular file `sshd'? y

[root@localhostinit.d]# cp /etc/init.d/sshd_bak /etc/init.d/sshd [root@localhostinit.d]# cd /usr/sbin/ [root@localhostsbin]# rmsshd

[root@localhostsbin]#cp /usr/sbin/sshd_bak/usr/sbin/sshd、

3.2安装rpm包

[root@localhost opt]# rpm -ivh openssh-5.3p1-94.el6.x86_64.rpm openssh-clients-5.3p1-94.el6.x86_64.rpm openssh-askpass-5.3p1-94.el6.x86_64.rpm openssh-server-5.3p1-94.el6.x86_64.rpm

[root@localhost opt]# service sshd start Starting sshd: [ OK ]

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

[root@localhost ~]# service sshd stop Stopping sshd: [ OK ]

[root@localhost ~]# cd /etc [root@localhostetc]# rm -rfssh

[root@localhostetc]# cp -r /etc/ssh_bak /etc/ssh/ [root@localhostetc]# cd /etc/init.d [root@localhostinit.d]#rmsshd rm: remove regular file `sshd'? y

[root@localhostinit.d]# cp /etc/init.d/sshd_bak /etc/init.d/sshd [root@localhostinit.d]# cd /usr/sbin/ [root@localhostsbin]# rmsshd

[root@localhostsbin]#cp /usr/sbin/sshd_bak/usr/sbin/sshd、

3.2安装rpm包

[root@localhost opt]# rpm -ivh openssh-5.3p1-94.el6.x86_64.rpm openssh-clients-5.3p1-94.el6.x86_64.rpm openssh-askpass-5.3p1-94.el6.x86_64.rpm openssh-server-5.3p1-94.el6.x86_64.rpm

[root@localhost opt]# service sshd start Starting sshd: [ OK ]

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

本文来源:https://www.bwwdw.com/article/xbd2.html

Top