此处升级操作的原则是保留系统原有ssh服务,新安装高版本ssh服务

1、下载openssh源码包

http://www.openssh.com/portable.html

2、安装
#tar zxvf openssh-7.2p2.tar.gz
#cd openssh-7.2p2
#./configure --prefix=/usr/local/openssh --sysconfdir=/usr/local/openssh/etc --with-pam --with-ssl-dir=/usr/local/openssl --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib
#make && make install
3、配置启动脚本和配置文件
cp /etc/init.d/sshd /ghca/bak/sshd #备份旧版sshd启动脚本
cp /ghca/openssh-7.2p2/contrib/redhat/sshd.init /etc/init.d/sshd ##拷贝新版启动脚本
vi /etc/init.d/sshd #编辑启动脚本

主要将以下内容

SSHD=/usr/sbin/sshd
/usr/bin/ssh-keygen -A
/sbin/restorecon /etc/ssh/ssh_host_key.pub
/sbin/restorecon /etc/ssh/ssh_host_rsa_key.pub
/sbin/restorecon /etc/ssh/ssh_host_dsa_key.pub
/sbin/restorecon /etc/ssh/ssh_host_ecdsa_key.pub

修改为:

SSHD=/usr/local/openssh/sbin/sshd
/usr/local/openssh/bin/ssh-keygen -A
/sbin/restorecon /usr/local/openssh/etc/ssh_host_key.pub
/sbin/restorecon /usr/local/openssh/etc/ssh_host_rsa_key.pub
/sbin/restorecon /usr/local/openssh/etc/ssh_host_dsa_key.pub
/sbin/restorecon /usr/local/openssh/etc/ssh_host_ecdsa_key.pub

注意:此时/usr/local/openssh/etc目录下可能没有那几个key,但是也可以先这样修改,具体这个几个key的用法还没做研究。

4、配置公私钥文件
#cd /root/.ssh
#/usr/local/openssh/bin/ssh-keygen -t rsa  #生成公私钥对
#cat id_rsa.pub >> authorized_keys  #写入公钥到服务器认证文件
5、将私钥文件下载保存至本地
/root/.ssh/id_rsa
6、重启sshd服务
/etc/init.d/sshd restart
7、配置本地SecureCRT并登录服务器
将对应服务器登录session配置中去掉密码验证,并配置公钥路径,如下图:

注意:openssh7.0以后就不允许root使用交互模式密码登录了,必须使用公钥登录,普通账号可以使用密码方式登录。

* The default for the sshd_config(5) PermitRootLogin option has
changed from "yes" to "prohibit-password".
* PermitRootLogin=without-password/prohibit-password now bans all
interactive authentication methods, allowing only public-key,
hostbased and GSSAPI authentication (previously it permitted
keyboard-interactive and password-less authentication if those
were enabled).

详见:http://bluereader.org/article/66465824?qqdrsign=07af0

openssh升级至7.2的更多相关文章

  1. CentOS openssh升级至7.4版本

    1.原环境: cat /etc/issue CentOS release 6.5 (Final) ssh -V OpenSSH_7.3p1, OpenSSL 1.0.1e-fips 11 Feb 20 ...

  2. Centos 升级至 OpenSSH 8 rpm包制作

    背景 安全部门扫描系统漏洞,OpenSSH 7.9出现漏洞,需升级到8. 使用 rpmbuild 将源码包编译为 rpm包. yum install rpm-build zlib-devel open ...

  3. CentOS6.5下面OpenSSH低版本升级至7.3

    升级前版本: openssl-1.0.1e-48.el6_8.1.x86_64 openssh-5.3p1-118.1.el6_8.x86_64 升级后版本: OpenSSL 1.0.2j OpenS ...

  4. Centos6升级至openssh-7.5p1

    最近公司有几台服务器需要搬至甲方(政府单位),所以在安装服务时用的是16年的openssh7.3pl, 今天通知我们有漏洞,需要再一次升级,看到官方文档上版本已升级至7.5,所以干脆直接搞7.5 具体 ...

  5. centos7升级openssl、openssh常见问题及解决方法

    升级至openssl 1.1.1版本 升级至openssh 8.0版本 openssl version -a   当前查看版本 一.安装telnet (以防升级失败,连不上服务器,建议弄) #查看是否 ...

  6. mysql5.x升级至mysql5.7后导入之前数据库date出错的解决方法!

    mysql5.x升级至mysql5.7后导入之前数据库date出错的解决方法! 修改mysql5.7的配置文件即可解决,方法如下: linux版:找到mysql的安装路径进入默认的为/usr/shar ...

  7. Ubantu【第一篇】:Ubantu中openssh连接

    h3 { color: rgb(255, 255, 255); background-color: rgb(30,144,255); padding: 3px; margin: 10px 0px } ...

  8. .NET跨平台之旅:将示例站点从 ASP.NET 5 RC1 升级至 ASP.NET Core 1.0

    终于将“.NET跨平台之旅”的示例站点 about.cnblogs.com 从 ASP.NET 5 RC1 升级至 ASP.NET Core 1.0 ,经历了不少周折,在这篇博文中记录一下. 从 AS ...

  9. Debian 8 jessie, OpenSSH ssh connection server responded Algorithm negotiation failed

    安装了debian 8.5 就出问题了. root@debian8:~# lsb_release -aNo LSB modules are available.Distributor ID: Debi ...

随机推荐

  1. ubuntu中常用软件的安装

    1.有道词典 1.百度有道词典,进入有道首页,点"下载词典客户端",下载对应版本. 2.打开终端,进入下载目录,输入sudo dpkg -i youdao-dict_1.0.2~u ...

  2. [LeetCode] 14. Longest Common Prefix

    Write a function to find the longest common prefix string amongst an array of strings. public class ...

  3. git 文件重命名

    文件重命名 git mv old_name new_name git commit -m 'rename' git push origin master 删除文件 git rm filename

  4. Spark之SQL解析(源码阅读十)

    如何能更好的运用与监控sparkSQL?或许我们改更深层次的了解它深层次的原理是什么.之前总结的已经写了传统数据库与Spark的sql解析之间的差别.那么我们下来直切主题~ 如今的Spark已经支持多 ...

  5. OAF_文件系列7_实现OAF处理Excel的JXL包介绍(概念)

    20150714 Created By BaoXinjian

  6. 关于Failed to install helloworld.apk on device 'emulator-5554!的一个解决办法

    好不容易架好了android环境,把该安得都安好了,结果发现在安装过程中创建一个虚拟设备映象就占用了c盘34g的空间,我的系统盘差点瘫了,看来以后就只能先用这一个虚拟设备调试了, 接着说上边这个问题, ...

  7. 在PHP中调用接口

    引用:http://zhidao.baidu.com/question/454935450.html&__bd_tkn__=67bd5d3a742a8b244e09a86fb8b824aa95 ...

  8. 浏览器缓存相关的Http头介绍:Expires,Cache-Control,Last-Modified,ETag

    转自:http://www.path8.net/tn/archives/2745 缓存对于web开发有重要作用,尤其是大负荷web系统开发中. 缓存分很多种:服务器缓存,第三方缓存,浏览器缓存等.其中 ...

  9. LeetCode 396. Rotate Function

    Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotati ...

  10. [DFNews] Cellebrite UFED系列更新, 支持IOS7

    10月15日,Cellebrite公司对旗下产品进行了更新,包括UFED Classic.UFED Touch.Physical Analyzer.Logical Analyzer.Phone Det ...