centos7下openssh升級方法(編譯安裝)


注意:
首先打開兩個或以上的shell連接,因為在升級過程中如果升級失敗會導致不發新建shell連接;升級后使用xshell6,7連接,openssh版本對應修改,下載地址:https://openbsd.hk/pub/OpenBSD/OpenSSH/

1.解壓:tar zxvf openssh-8.2p1.tar.gz
2.查看當前安裝的ssh rpm -qa|grep ssh
3.卸載當前的ssh rpm -e --nodeps openssh-askpass-5.3p1-94.el6.x86_64 openssh-clients-5.3p1-94.el6.x86_64 openssh-5.3p1-94.el6.x86_64 openssh-server-5.3p1-94.el6.x86_64
4.安裝依賴包 yum install -y openssl-devel
5.編譯新的ssh
刪除/etc/ssh/下的密鑰對,rm -f /etc/ssh/ssh_host_*
cd openssh-8.2p1
./configure --prefix=/usr --sysconfdir=/etc/ssh
make && make install
6.安裝成功之后,查看版本 ssh-V
7.修改配置文件 sshd_config 把permitrootlogin xxx去掉注釋 改成 permitrootlogin yes
把 #UseDNS no 修改 UseDNS no
8.把sshd拷貝到 /etc/init.d下面
cp -a contrib/redhat/sshd.init /etc/init.d/sshd
cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
chmod +x /etc/init.d/sshd
chkconfig --add sshd
systemctl enable sshd
chkconfig sshd on
mv  /usr/lib/systemd/system/sshd.service  /opt/ (執行后如提示沒有文件,忽略即可)
mv  /usr/lib/systemd/system/sshd.socket  /opt/ (執行后如提示沒有文件,忽略即可)


9.啟動 /etc/init.d/sshd 后面無需加start等參數。

 

 

 

 

 

歡迎進群討論:QQ群294668383(有意向可以添加)


免責聲明!

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



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