openssh升级至7.2

此处升级操作的原则是保留系统原有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配置中去掉密码验证,并配置公钥路径,如下图:

openssh升级至7.2

注意: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

Original: https://www.cnblogs.com/Before/p/5522560.html
Author: lzc_jack
Title: openssh升级至7.2

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/612041/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • 理论知识

    多线程的实现方式:1.继承Thread类;2.实现runnable接口;3.实现callable接口通过futrueTask包装器来创建Thread线程; 是继承Thread类号还…

    Linux 2023年6月7日
    0101
  • zabbix快速安装(yum)

    1、先卸载系统自带数据库 [root@bogon ~]# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 –nodeps 2、安装mys…

    Linux 2023年6月6日
    077
  • k8s多集群切换:使用kubeconfig文件管理多套kubernetes(k8s)集群

    一.系统环境 二.前言 三.kubeconfig文件 四.kubernetes(k8s)多集群切换 一.系统环境 服务器版本 docker软件版本 CPU架构 CentOS Lin…

    Linux 2023年6月7日
    0127
  • Linux 下重启 PHP 服务、nginx 服务

    一、重启 PHP 服务 service php-fpm start 开启 service php-fpm stop 停止 service php-fpm restart 重启 二、…

    Linux 2023年6月13日
    071
  • SpringSecurity

    SpringSecurity 11.1 SpringSecurity简介 Spring 是一个非常流行和成功的 Java 应用开发框架。Spring Security 基于 Spr…

    Linux 2023年6月14日
    086
  • 【Linux】指令学习

    Linux学习记录 😄生命不息,写作不止🏆 一个有梦有戏的人 @怒放吧德德🌝分享学习心得,欢迎指正,大家一起学习成长! 1、虚拟机网卡配置 服务器重启完成之后,我们可以通过linu…

    Linux 2023年6月6日
    0115
  • muduo项目介绍

    在上一个集群聊天服务器项目中,我使用了 muduo作为网络库,然后主要实现了业务逻辑等,所以为了深入网络库的代码和实现,我跟着一位老师的代码去实现了 muduo库的基本原理和作用,…

    Linux 2023年6月13日
    097
  • C语言基本语法

    C语言以分号代表一条语句结束,一条命令可以在多行显示 对于空格没有多大要求,只是为了代码美观,方便看懂,但python语法就比较严格必须要加空格 注释VS快捷键Ctrl+K,然后C…

    Linux 2023年6月8日
    085
  • 基于AnolisOS8.6安装OceanBase数据库

    网络配置 cd /etc/sysconfig/network-scripts/ ls vi ifcfg-ens33 修改网络配置 TYPE=Ethernet PROXY_METHO…

    Linux 2023年6月7日
    098
  • linux学习之shell脚本

    【实验目的】‍ ‌ 通过本实验练习,使学生了解常用SHELL的编程特点,掌握SHELL 程序设计的基础知识。对SHELL程序流程控制、SHELL程序的运行方式、bash程序的调试方…

    Linux 2023年5月27日
    0119
  • 多表查询练习题

    十道多表查询练习题 准备数据: 查询所有的课程的名称以及对应的任课老师姓名 查询姓李老师的个数 查询挂科超过两门(包括两门)的学生姓名和班级、查询选修了所有课程的学生姓名 post…

    Linux 2023年6月7日
    092
  • MySQL manager or server PID file could not be found!

    [root@centos var]# service mysqld stop MySQL manager or server PID file could not be found…

    Linux 2023年6月13日
    081
  • 解决端口被占用问题

    在 Linux 里查看端口被哪个进程占用(以Apache服务80端口为例,其余的端口一样方法处理) [root@localhost /]# lsof -i:80 #查看进程 COM…

    Linux 2023年6月7日
    0126
  • 【Docker搭建】2. 在Docker中安装Redis5.0

    1. 安装Docker,详细 请看安装教程 。若已安装,请看 2. 2. 拉取 Redis 镜像 docker pull redis:5.0.5 3. 设置 Redis 配置文件 …

    Linux 2023年6月13日
    081
  • K8s-小型综合实验(k8s+keeplived+nginx+iptables)

    K8S小型综合实验(k8s+keeplived+nginx+iptables) 实验目的 1.Kubernetes 区域可采用 Kubeadm 方式进行安装。 2.要求在 Kube…

    Linux 2023年6月13日
    097
  • 惊了!修仙=编程??

    大家好,我是良许。 在我记忆中,我们接触到的所有编程书籍都是这样的: [En] As far as I can remember, all the programming book…

    Linux 2023年5月27日
    084
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球