升级openssh步骤(7.6p1)

打开telnet服务,以防万一
修改设置文件/etc/xinetd.d/telnet中disable字段改为no。
重启服务#ntsysv或#service xinetd restart。

=========================================

安装zlib

#tar -zxvf zlib-1.2.11.tar.gz
#cd zlib-1.2.11
#./configure --prefix=/usr/local/zlib-1.2.11 -share
#make
#make test
#make install
   rm -f /usr/local/zlib-1.2.11/lib/libz.a
   cp libz.a /usr/local/zlib-1.2.11/lib
   chmod 644 /usr/local/zlib-1.2.11/lib/libz.a
   cp libz.so.1.2.11 /usr/local/zlib-1.2.11/lib
   chmod 755 /usr/local/zlib-1.2.11/lib/libz.so.1.2.11
   rm -f /usr/local/zlib-1.2.11/share/man/man3/zlib.3
   cp zlib.3 /usr/local/zlib-1.2.11/share/man/man3
   chmod 644 /usr/local/zlib-1.2.11/share/man/man3/zlib.3
   rm -f /usr/local/zlib-1.2.11/lib/pkgconfig/zlib.pc
   cp zlib.pc /usr/local/zlib-1.2.11/lib/pkgconfig
   chmod 644 /usr/local/zlib-1.2.11/lib/pkgconfig/zlib.pc
   rm -f /usr/local/zlib-1.2.11/include/zlib.h /usr/local/zlib-1.2.11/include/zconf.h
   cp zlib.h zconf.h /usr/local/zlib-1.2.11/include
   chmod 644 /usr/local/zlib-1.2.11/include/zlib.h /usr/local/zlib-1.2.11/include/zconf.h
#vi /etc/ld.so.conf    配置库文件搜索路径
 include ld.so.conf.d/*.conf
 ##add 2017.11.15
 /usr/local/zlib-1.2.11/lib
 ##add end
#ldconfig -v       刷新缓存文件/etc/ld.so.cache
#ln -s /usr/local/zlib-1.2.11 /usr/local/zlib

=======================================================
安装openssl
#tar zxvf openssl-1.0.2m.tar.gz
#cd openssl-1.0.2m
#./config shared zlib-dynamic --prefix=/usr/local/openssl-1.0.2m --with-zlib-lib=/usr/local/zlib-1.2.11/lib --with-zlib-include=/usr/local/zlib-1.2.11/include
#make
#make test (这一步是进行 SSL 加密协议的完整测试,如果出现错误就要一定先找出原因,否则一味继续可能导致 SSH 不能使用!)
#make install
#vi /etc/ld.so.conf      配置库文件搜索路径
############################################
## add below line to ld.so.conf
/usr/local/openssl-1.0.2m/lib                  
############################################
#ldconfig -v       刷新缓存文件/etc/ld.so.cache
#ln -s /usr/local/openssl-1.0.2m /usr/local/openssl

vi /etc/profile
###########################################
(add to end of the file)
PATH=/usr/local/openssl/bin:$PATH
export PATH
###########################################


退出,再登录,查看openssl的版本号,以验正是否安装正确
#openssl version -a
OpenSSL 1.0.2m  2 Nov 2017
built on: reproducible build, date unspecified
platform: linux-x86_64
options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: gcc -I. -I.. -I../include -I/usr/local/zlib-1.2.11/include -fPIC -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/usr/local/openssl-1.0.2m/ssl"

============================================================================
停止并卸载Openssh
1.停止OpenSSH服务
#service sshd stop

2. 查询并卸载openssh
# rpm -qa | grep openssh
openssh-askpass-4.3p2-72.el5
openssh-4.3p2-72.el5
openssh-clients-4.3p2-72.el5
openssh-server-4.3p2-72.el5

#rpm -e openssh-askpass-4.3p2-72.el5
#rpm -e openssh-4.3p2-72.el5 --nodeps
#rpm -e openssh-clients-4.3p2-72.el5
#rpm -e openssh-server-4.3p2-72.el5  --nodeps


tar zxvf openssh-7.6p1.tar.gz
cd  openssh-7.6p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr/local/openssl --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib

#make
#make install
#

将sshd加入启动服务:
进入ssh安装解压目录
#cp ./contrib/redhat/sshd.init /etc/init.d/sshd
#chmod +x /etc/init.d/sshd
#chkconfig --add sshd
最后,启动 SSH 服务使修改生效:
# service sshd start
重启后确认一下当前的 OpenSSH 和 OpenSSL 是否正确:
# ssh -v
如果看到了新的版本号就没问题啦!

由于缺省禁止root远程登录,如果要允许的话,修改/etc/ssh/sshd_config下列参数:
#PermitRootLogin prohibit-password

PermitRootLogin yes

并重起sshd



关闭telnet服务
修改设置文件/etc/xinetd.d/telnet中disable字段改为yes。
启动服务#ntsysv或#service xinetd restart。

  • 9
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值