首页 > 系统相关 >centos9升级openssh 9.4p1

centos9升级openssh 9.4p1

时间:2023-11-20 15:33:04浏览次数:29  
标签:bin sshd p1 -- openssh etc ssh centos9 usr

本文参考:https://www.cnblogs.com/wenxiao1-2-3-4/p/16481300.html

#!/bin/sh


cd /etc/yum.repos.d

mkdir backup

mv Cent* backup

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-9.repo

yum -y clean all

yum -y makecache  #以上设置云源



cd /tmp

mkdir update

cd update

wget --no-check-certificate https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.4p1.tar.gz

tar xf openssh-9.4p1.tar.gz

yum -y install zlib zlib-devel perl openssl-devel

yum -y install gcc gcc-c++

mv /etc/ssh /etc/ssh.bak

cd /tmp/update/openssh-9.4p1

mkdir /usr/local/openssh

cd /tmp/update/openssh-9.4p1

./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/include --with-ssl-dir=/usr/local/bin/openssl --with-zlib --with-md5-passwords --without-openssl-header-check

#centos7是下面

#./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/include --with-ssl-dir=/usr/local/bin/openssl --with-zlib --with-md5-passwords --without-openssl-header-check



make

make install

echo "UseDNS no" >> /etc/ssh/sshd_config

echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config

echo 'PubkeyAuthentication yes' >> /etc/ssh/sshd_config

echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config

echo "X11Forwarding yes" >> /etc/ssh/sshd_config

#echo "X11UseLocalhost no" >> /etc/ssh/sshd_config  

echo "XAuthLocation /usr/bin/xauth" >> /etc/ssh/sshd_config

mv /usr/sbin/sshd /usr/sbin/sshd0909

mv /usr/bin/ssh /usr/bin/ssh0909

mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen0909

ln -s /usr/local/openssh/bin/ssh /usr/bin/ssh

ln -s /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen

ln -s /usr/local/openssh/sbin/sshd /usr/sbin/sshd

ssh -V

mv /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.service.bak

cp -arf ./contrib/redhat/sshd.init /etc/rc.d/init.d/sshd

cp -arf ./contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

chkconfig --add sshd

systemctl enable sshd --now

systemctl restart sshd


/etc/rc.d/init.d/sshd目录加入启动脚本后,systemctl start sshd 如识别不到,请尝试关闭selinux 或者重启系统尝试,执行启动脚本后报错误如下:

 

centos9升级openssh 9.4p1_启动脚本

查看文件/etc/rc.d/init.d/sshd 文件49行,文件如下

centos9升级openssh 9.4p1_启动脚本_02

 

 将编译后的配置文件拷贝到 /etc/ssh/下,重新执行,仍然报错。查看脚本第一行发现缺少文件

centos9升级openssh 9.4p1_启动脚本_03

 

 拷贝centos7.6版本的functions 文件上传,重新启动后成功

可从cnetos7系列系统中/etc/init.d/目录提取,这里我上传了一个我使用的文件


如ssh启动不了,如下:

#关闭selinux     vi /etc/selinux/config  手工

#修改SELINUX=enforce为SELINUX=disable  重启服务器后

restorecon -r -v /root/.ssh

#开启selinux    vi /etc/linux/config  手工

#修改为SELINUX=enforcing

systemctl start sshd

标签:bin,sshd,p1,--,openssh,etc,ssh,centos9,usr
From: https://blog.51cto.com/u_14775406/8489218

相关文章

  • 从热爱到深耕,全国Top10开源软件出品人探索“开源云上行”
    本文分享自华为云社区《【先锋开发者云上说】从热爱到深耕,全国Top10开源软件出品人探索“开源云上行”》,作者:华为云社区精选。《2022-2023中国开源开发者调查报告》中有数据显示:只有2%的开发者从未使用过开源,49%的开发者表示参与过开源;63%的开发者从未在开源中获得收入,超过80%的......
  • 浮点数格式: FP64, FP32, FP16, BFLOAT16, TF32
    浮点数格式(参考1,参考2)浮点数是一种用二进制表示的实数,它由三个部分组成:sign(符号位)、exponent(指数位)和fraction(小数位)。不同的浮点数格式有不同的位数分配给这三个部分,从而影响了它们能表示的数值范围和精度。例如: 下面是一些常见的浮点数格式的介绍:FP64(双精度浮点数):用64位......
  • 面试必刷TOP101:30、 二叉搜索树与双向链表
    题目输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。如下图所示题解方法一:非递归版解题思路:1.核心是中序遍历的非递归算法。2.修改当前遍历节点与前一遍历节点的指针指向。importjava.util.Stack;publicTreeNodeConvertBSTToBiList(TreeNoderoot){......
  • 基于mdev实现adb热插拔(@STM32MP157D+fusb302)
    关键词:fusb302、uevent、mdev、adbd等等。1fusb302关于USB插拔检测,以及增加uevent事件fsusb302支持USBPowerDelivery协议(USBPowerDelivery),支持识别各种USB设备和对应的状态。fusb302支持DRP(DualRolePower)、DFP(DownstreamFacingPort)、UFP(UpstreamFacingPort)......
  • 【洛谷 P1125】[NOIP2008 提高组] 笨小猴 题解(字符串+映射+集合)
    [NOIP2008提高组]笨小猴题目描述笨小猴的词汇量很小,所以每次做英语选择题的时候都很头疼。但是他找到了一种方法,经试验证明,用这种方法去选择选项的时候选对的几率非常大!这种方法的具体描述如下:假设是单词中出现次数最多的字母的出现次数,是单词中出现次数最少的字母的出现次数,......
  • P1605 迷宫
    题目描述给定一个\(N\timesM\)方格的迷宫,迷宫里有\(T\)处障碍,障碍处不可通过。在迷宫中移动有上下左右四种方式,每次只能移动一个方格。数据保证起点上没有障碍。给定起点坐标和终点坐标,每个方格最多经过一次,问有多少种从起点坐标到终点坐标的方案。输入格式第一行为三......
  • P1098 [NOIP2007 提高组] 字符串的展开(总结)
    P1098[NOIP2007提高组]字符串的展开http://ww.luogu.com.cn/problem/P1098注意字符中的数字是默认小于字母的。所以要对数字做特判。#include<iostream>#include<string>usingnamespacestd;intmain(){ intp1,p2,p3; cin>>p1>>p2>>p3; strings; cin......
  • P1064-DP【绿】
    好多好多天前写了这道题的50分代码,然后不知道错在哪里反复调没调对。然后这周我极度忙,忙死了,好不容易有一点时间再来审视这道题了,然后我5分钟想明白了一切...把DP数组定义的那句intDP[100][5000]改成intDP[100][50000]就直接AC了...此前的50代码错的5个点都是WA而不是RE,说明编......
  • P1486 [NOI2004] 郁闷的出纳员
    P1486[NOI2004]郁闷的出纳员有两种思路,均使用fhq-treap实现维护一个变量delta表示全局偏移量,对于新插入的数减去偏移量。使用fhq-treap,可以分裂出<mid的部分,直接丢掉。直接用fhq-treap维护一个类似于线段树的懒标记,每次放在根上即可。方法1#include<iostream>#include<r......
  • P19 连词
    目录视频链接:https://www.bilibili.com/video/BV1XY411J7aG/?p=19&spm_id_from=pageDriver&vd_source=30920241a27fdc74fb4997d5fe82d626......