此处升级操作的原则是保留系统原有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. sp_who_lock

    USE MyDataBase GO /****** Object: StoredProcedure [dbo].[sp_who_lock] Script Date: 4/10/2015 ******/ ...

  2. javax.servlet.http.HttpServlet was not found

    我们遇到的错误显示如下:   我们右击有错误提示的文件夹,如下:   我们点击"配置构建路径",如下:   我们再点击"添加库",如下:   我们选中上图中标出 ...

  3. ubuntu 常见问题

    1.problem 1 用apt-get安装时,提示:E could not get lock /vaa/lib/dpkg/lock -open等 reasons :可能是由于上次使用apt-get ...

  4. HTTP 协议详解

    相关文章:HTTP 协议之压缩 当今web程序的开发技术真是百家争鸣,ASP.NET, PHP, JSP,Perl, AJAX 等等. 无论Web技术在未来如何发展,理解Web程序之间通信的基本协议相 ...

  5. linux查找日志技巧

    对于从事web开发的人员来说.服务器上的日志多如牛毛,如何快速从中找出所需信息非常重要,以下是我在工作中用到的查找日志的简单命令,希望能对您有所帮助:   工具/原料   linux SecureCR ...

  6. selenium + phantomjs 爬取落网音乐

    题记: 作为一个业余程序猿,最大的爱好就是电影和音乐了,听音乐当然要来点有档次的.落网的音乐的逼格有点高,一听听了10年.学习python一久了,于是想用python技术把落网的音乐爬下来随便听. 目 ...

  7. 炉石ZZ操作 [20161224]

    昨天吃完晚饭,开了一盘炉石.选的龙牧,遇到对面马克扎尔战士. 中途,我场上3个较大随从,他突然先拍下一个铜须,菊花一紧,然后果然拍下了大工匠(之前用龙人侦察者看到他牌库有这张牌),逗比的一幕开始了,首 ...

  8. openlayers中实现自定冒泡的效果

    自定义的Openlayers.Popup.FreshCloud继承自Openlayers.Popup.Framed,实现了比较简洁的冒泡效果,详细代码如下 /** * Class: OpenLayer ...

  9. Burp SuiteBurp Suite使用详解

    http://www.2cto.com/Article/201209/153312.html Burp Suite是Web应用程序测试的最佳工具之一,其多种功能可以帮我们执行各种任务.请求的拦截和修改 ...

  10. xfce4 启用回收站

    Userspace virtual filesystem implemented as a pluggable module for gio # pacman -S gvfs