天天看點

更新openssh版本

有網絡情況下

1 下載下傳包,編譯

2 解決如下環境報錯:

   configure: error: *** zlib.h missing - please install first or check config.log ***

3 編譯

4 覆寫配置檔案

   make install覆寫/etc/ssh配置檔案時可能會報錯,删掉/etc/ssh下的報錯配置檔案,再make install一次就可以了。但是有時候可能需要把整個代碼删掉重新解壓重複以上過程。

5 如果使用root遠端無法登入,修改/etc/ssh/sshd_config

   PermitRootLogin yes。

6 檢視更新後的版本

<code></code>

無網絡如何更新

1、準備相關的包

   openssh下載下傳位址:http://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/

   openssl相關包下載下傳:http://www.openssl.org/source/

   pam相關包下載下傳:http://pkgs.org/centos-6/centos-x86_64/

   zlib包下載下傳: http://zlib.net/

2、安裝zlib

   tar -zxvf zlib-1.2.8.tar.gz

   cd zlib-1.2.8

   ./configure --prefix=/usr/local/zlib &amp;&amp; make &amp;&amp; make install

3、安裝openssl-fips

   tar zxvf openssl-fips-2.0.5.tar.gz

   cd openssl-fips

   ./config

   make &amp;&amp; make install

4、安裝openssl

    tar -zxvf openssl-1.0.1h.tar.gz

    cd openssl-1.0.1h

    ./config fips --shared    

    make &amp;&amp; make install

5、将新編譯的openssl library 加入系統動态庫連結中

    echo "/usr/local/ssl/lib" &gt;&gt; /etc/ld.so.conf

    ldconfig

6、安裝pam,首先解除安裝舊版本

    檢視版本資訊:rpm -qa|grep pam

    解除安裝舊版本:rpm -e --nodeps pam-1.1.1-17.el6.x86_64

    安裝pam:依次安裝

    rpm -ivh tcp_wrappers-devel-7.6-57.el6.x86_64.rpm

    pam-1.1.1-20.el6_7.1.x86_64.rpm

    pam-devel-1.1.1-20.el6_7.1.x86_64.rpm

7、安裝OpenSSH

    tar zxvf openssh-7.1p1.tar.gz

    cd openssh-7.1p1

    ./configure \

--prefix=/usr \

--sysconfdir=/etc/ssh \

--with-md5-passwords \

--with-pam \

--with-tcp-wrappers \

--with-ssl-dir=/usr/local/ssl \

--with-zlib=/usr/local/zlib \

--without-hardening

8、加入到系統服務,重新開機sshd更新成功

    chkconfig --add sshd

    service sshd restart

繼續閱讀