CentOS7&麒麟V10通過rpm包升級openssh


更新:2023.08.09 openssh9.4p1發布,2023.09.27重新編譯。

[root@localhost ~]# ssh -V

OpenSSH_9.4p1, OpenSSL 3.0.11 19 Sep 2023

 

由於官方沒有rpm包,網上大部分教程都是通過源碼編譯升級,操作復雜且步驟較多。這里使用當前最新的openssh發布版本編譯成了rpm包,可以使用yum升級。同時寫了個升級腳本方便使用。好用的話大家給留個評論。

編譯及升級過程參考:https://www.cnblogs.com/yanjieli/p/14220914.html

升級包下載(復制鏈接到新標簽頁下載),:https://wwmm.lanzoub.com/inOqx1a6jo7i 密碼:e0r1

順帶打了一個銀河麒麟V10的openssh升級包,有信創需求的使用:openssh-9.1p1-rpm-ky10.tar.gz

升級腳本:update.sh

#!/bin/bash
# by wzl

echo '當前版本:'
ssh -V

update() {
    echo '備份配置文件'
    cp /etc/pam.d/{sshd,sshd.bak}
    cp /etc/ssh/{sshd_config,sshd_config.bak}

    sleep 1
    echo '更新rpm'
    yum update -y $(dirname $0)/openssh*

    clear

    echo '當前版本:'
    ssh -V
    echo '恢復配置'
    mv -f /etc/ssh/sshd_config.bak /etc/ssh/sshd_config
    mv -f /etc/pam.d/sshd.bak /etc/pam.d/sshd

    sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
    sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
    chmod 600 /etc/ssh/*
echo '重啟sshd' systemctl restart sshd } echo '該腳本自動升級openssh,在CentOS7.X測試通過,繼續升級輸入y,取消n' read -p "確認?[y/n]" input if [ $input = "y" ];then update elif [ $input = "n" ]; then echo "未升級,退出" exit else echo "輸入有誤,請重新輸入" exit fi

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM