linux升級openssh


升級sshd到OpenSSH-6.7並刪除老版本ssh

1)升級前准備

查看是否缺包

# rpm -qa | egrep "gcc|make|perl|pam|pam-devel"

如果有配置yum了的話可以直接yum安裝這些包,這樣既可以檢驗是否裝了,沒裝的直接裝上。

yum -y install gcc* make perl pam pam-devel

2)下載openssh-7.3p1.tar.gz

ftp://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/openssh-7.3p1.tar.gz

備份ssh :

# mv /etc/ssh /etc/ssh.bak

# openssl version -a

3)編譯安裝新版本openssh

# tar zxf openssh-6.7p1.tar.gz && cd openssh-6.7p1 

# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords   

# make

先卸載完舊版本的openssh,再make install

# rpm -qa | grep openssh 

# rpm -e `rpm -qa | grep openssh`

Openssh-askpass是用於圖形界面下輸入口令的,用不着可以不裝

# make install

4)查看是否升級到新版本

5)復制啟動腳本到/etc/init.d

# cp /root/openssh-6.7p1/contrib/RedHat/sshd.init /etc/init.d/sshd

加入開機自啟

# chkconfig --add sshd

6)啟動sshd,用start或reload。不要restart,restart 會直接斷開連接,而並不會接着啟動sshd服務,這時候要通過其他途徑進入機器,然后啟動sshd服務才行。

 

編譯時候錯誤:PAM headers not found

解決方案:

查看pam已經安裝的包再下載他的依賴庫

yum install -y pam-devel


免責聲明!

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



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