RedHat更新Openssh到最新版本

由于目前服务器上ssh版本较低,存在安全漏洞,需要升级到最新版本。

 

系统版本:RedHat 6.6 

旧openSSH版本:5.3p1

新openSSH版本:7.4p1

升级方式:源码安装

 

1.更新ssl

 

yum update openssl

 

更新ssl到OpenSSL 1.0.1e-fips

2.备份ssh目录

 

cp -rf /etc/ssh /etc/ssh.bak

3.安装telnet,以备ssh更新失败无法远程连接,如果可以现场操作可忽略

 

4.安装升级所需组件

 

yum install -y gcc openssl-devel pam-devel rpm-build

 

5.解压升级包,并安装(如需卸载旧版openSSH,查看步骤8)

tar -zxvf openssh-7.4p1.tar.gz 
cd openssh-7.4p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords 
make && make install

安装后提示

 

/etc/ssh/ssh_config already exists, install will not overwrite
/etc/ssh/sshd_config already exists, install will not overwrite
/etc/ssh/moduli already exists, install will not overwrite
ssh-keygen: generating new host keys: ECDSA ED25519 
/usr/sbin/sshd -t -f /etc/ssh/sshd_config
/etc/ssh/sshd_config line 81: Unsupported option GSSAPIAuthentication
/etc/ssh/sshd_config line 83: Unsupported option GSSAPICleanupCredentials

 

 

6.修改配置文件允许root用户远程登陆

 

vim /etc/ssh/sshd_config

 

#PermitRootLogin yes
修改为
PermitRootLogin yes

 

 

7.重启openSSH

 

service sshd reload

 

8.如果需要卸载旧版openSSH

 

查看旧版openSSH

rpm -qa | grep openssh

 

 

 

 

卸载旧版openSSH

 

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

 

9.安装新版openSSH

 

tar -zxvf openssh-7.4p1.tar.gz 
cd openssh-7.4p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords 
make && make install

 

10.复制启动脚本到/etc/init.d

cp /xx/openssh-7.4p1/contrib/RedHat/sshd.init /etc/init.d/sshd

 

11.加入开机启动


 

12.启动sshd

用start或reload。不要restart,restart 会直接断开连接,而并不会接着启动sshd服务,这时候要通过其他途径进入机器,然后启动sshd服务才行。


 

13.查看ssh版本

 

ssh -V

 

 

 

 

 

参考:

http://blog.csdn.net/levy_cui/article/details/53100315

http://www.2cto.com/os/201510/445119.html

 

 

 

 

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值