大佬勿喷❗️谢谢!❗️[滑稽]
1)备份旧SSH相关目录 代码(图一):
1│[root@k8s-master02 ~]# mv /etc/ssh /etc/ssh-$(date +%F)
2│[root@k8s-master02 ~]# cp /etc/pam.d/system-auth /etc/pam.d/system-auth-$(date +%F)
3│[root@k8s-master02 ~]# cp /etc/pam.d/sshd /etc/pam.d/sshd-$(date +%F)
2)删除旧SSH软件包 代码(图二):
1│[root@k8s-master02 ~]# rpm -qa | grep openssh > openssh.txt
2│[root@k8s-master02 ~]# for i in $(cat openssh.txt);do rpm -e $i –nodeps;done
3)下载SSH软件包,并安装 代码(图三):
1│[root@k8s-master02 ~]# wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
2│[root@k8s-master02 ~]# tar xf openssh-9.0p1.tar.gz
3│[root@k8s-master02 ~]# cd openssh-9.0p1/
4│[root@k8s-master02 openssh-9.0p1]# yum -y install gcc* cmake
5│[root@k8s-master02 openssh-9.0p1]# ./configure –prefix=/usr –sysconfdir=/etc/ssh && make && make install
6│[root@k8s-master02 openssh-9.0p1]# cp contrib/redhat/sshd.init /etc/init.d/sshd
7│[root@k8s-master02 openssh-9.0p1]# chkconfig –add sshd
8│[root@k8s-master02 openssh-9.0p1]# chkconfig sshd on
9│[root@k8s-master02 openssh-9.0p1]# systemctl restart sshd
4)验证 代码(图四):
1│[root@k8s-master02 ~]# ssh -Version
2│OpenSSH_9.0p1, OpenSSL 1.0.2k-fips 26 Jan 2017
图五可以看到,图中,我们在远程验证时,输出:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! 信息。原因是因为我这里使用过旧版本的 SSH 远程到目标主机过,当远程时,SSH 便会将远程主机的 public key 记录到 known_hosts 文件中。
当再进行远程时,SSH 将会根据 known_hosts 文件来验证远程主机的公钥。如若不匹配,SSH 便会输出警告信息。而我们上面刚好在远程主机上升级过 SSH,所以便导致 public key 发生改变。不过,我们只需要将 known_hosts 文件,重新远程即可。
代码:
1│[root@k8s-master01 ~]# rm -rf ~/.ssh/known_hosts
如果本贴有违规请联系我,我进行更改❗️谢谢[滑稽]![图片[1]-使用CentOS系统升级OpenSSH教程-朝晞小屋](https://image.baidu.com/search/down?url=http://cdn.u1.huluxia.com/g4/M03/FF/F6/rBAAdmKAzhqAKOp9AACEHEkR4-k380.jpg)
![图片[2]-使用CentOS系统升级OpenSSH教程-朝晞小屋](https://image.baidu.com/search/down?url=http://cdn.u1.huluxia.com/g4/M03/FF/F6/rBAAdmKAzhuALv0ZAABbVt3k7sU029.jpg)
![图片[3]-使用CentOS系统升级OpenSSH教程-朝晞小屋](https://image.baidu.com/search/down?url=http://cdn.u1.huluxia.com/g4/M03/FF/F6/rBAAdmKAzhuATZjTAAFvfv1_vDY236.jpg)
![图片[4]-使用CentOS系统升级OpenSSH教程-朝晞小屋](https://image.baidu.com/search/down?url=http://cdn.u1.huluxia.com/g4/M03/FF/F6/rBAAdmKAzhyAPWKtAABYrvkHQfk513.jpg)
![图片[5]-使用CentOS系统升级OpenSSH教程-朝晞小屋](https://image.baidu.com/search/down?url=http://cdn.u1.huluxia.com/g4/M03/FF/F6/rBAAdmKAzhyADAxXAAPm567RfLY061.jpg)

















![战神引擎传奇手游【1.80恒世复古[白猪3.1]】2025整理复古服务端+冰雪之城+水上城市+迷幻蚁园【站长亲测】-朝晞小屋](https://aliyun.zxiyun.com/images/2025/11/62184-战神引擎传奇手游【1-80恒世复古白猪3-1】2025整理复古-j3t3k5-800x450.jpg)


暂无评论内容