openssh升级后root_Centos6/7升级openssh7.9

适用centos6/

bdf955369da9a943ae363d8ba544156c.png

7升级操作

当前openssh-server版本

  • [root@localhost ~]# rpm -qa | grep opensshroot@localhost ~]# rpm -qa | grep openssh
  • openssh-clients-5.3p1-117.el6.x86_64
  • openssh-5.3p1-117.el6.x86_64
  • openssh-server-5.3p1-117.el6.x86_64

下载源码包

  • [root@localhost src]# curl -O

解压源码包

  • [root@localhost src]# tar zxvf openssh-7.9p1.tar.gz

进入源码目录

  • [root@localhost src]# cd openssh-7.9p1/

安装编译工具及依赖包

  • [root@localhost openssh-7.9p1]# yum -y install gcc make openssl-devel pam-devel zlib-devel rpm-build

配置

  • [root@localhost openssh-7.9p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --without-hardening

编译源码

  • [root@localhost openssh-7.9p1]# make

安装源码

  • [root@localhost openssh-7.9p1]# make install

修改配置文件

  • sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config #或手动修改PermitRootLogin no 修改为 PermitRootLogin yes 允许root远程登陆
  • sed -i 's/#PermitEmptyPasswords(.*)/PermitEmptyPasswords no/g' /etc/ssh/sshd_config ##禁止空密码
  • sed -i 's/^SELINUX(.*)/SELINUX=disabled/g' /etc/selinux/config ##重点来了~~~禁止selinux 否则重启后会登录失败

拷贝启动脚

  • [root@localhost openssh-7.9p1]# cp -rf contrib/redhat/sshd.init /etc/init.d/sshd

添加到服务管理

  • [root@localhost openssh-7.9p1]# chkconfig --add sshd

添加到开机服务

  • [root@localhost openssh-7.9p1]# chkconfig sshd on

查看ssh客户端版本,版本已经升级。

  • [root@localhost src]# ssh -V
  • OpenSSH_7.9p1, OpenSSL 1.0.1e-fips 11 Feb 2013

查看sshd位置

  • [root@localhost src]# which sshd
  • /usr/sbin/sshd

查看sshd服务端版本,版本已经升级。

  • [root@localhost src]# strings /usr/sbin/sshd | grep OpenSSH
  • OpenSSH_7.9p1
  • OpenSSH_7.9
  • OpenSSH_3.*
  • OpenSSH_5*
  • OpenSSH_6.6.1*
  • OpenSSH_6.5*,OpenSSH_6.6*
  • OpenSSH*
  • OpenSSH_2.*,OpenSSH_3.0*,OpenSSH_3.1*
  • OpenSSH_2*,OpenSSH_3*,OpenSSH_4*
  • OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7*

重启sshd服务

centos6.8升级openssh-7.9p1完成,重新登录服务器就可以。

如果登陆出现加密算法报错请按照以下方法进行处理

# ssh -Q cipher

3des-cbc

blowfish-cbc

cast128-cbc

arcfour

arcfour128

arcfour256

aes128-cbc

aes192-cbc

aes256-cbc

rijndael-cbc@lysator.liu.se

aes128-ctr

aes192-ctr

aes256-ctr

aes128-gcm@openssh.com

aes256-gcm@openssh.com

chacha20-poly1305@openssh.com

打开然后/etc/ssh/sshd_config找到Ciphers *****那一行改就是了。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值