升級openssh

升級最新版本的openssh6.1

安裝zlib

tar zxvf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure --prefix=/usr/local/zlib
make && make install

安裝openssl
下載最新包:
http://www.openssl.org/source/openssl-1.0.1c.tar.gz

tar zxvf openssl-1.0.1c.tar.gz
cd openssl-1.01c
./config shared zlib --prefix=/usr/local/openssl
make && make install

whereis openssl
cd /usr/bin/
mv openssl openssl.bak
ln -s /usr/local/openssl/bin/openssl .

cd /usr/include/
mv openssl openssl.bak
ln -s /usr/local/openssl/include/openssl .

驗證:
openssl version
OpenSSL 1.0.1c 10 May 2012

echo "/usr/local/openssl/lib/" >> /etc/ld.so.conf

ldconfig


安裝openssh
下載最新安裝包:
http://openbsd.org.ar/pub/OpenBSD/OpenSSH/portable/openssh

-6.1p1.tar.gz
tar zxvf openssh-6.1p1.tar.gz
cd openssl-6.1p1
./configure  --prefix=/usr//local/openssh --

sysconfdir=/usr/local/openssh/etc/ssh --with-pam --with-

zlib=/usr/local/zlib/ --with-ssl-dir=/usr/local/openssl/ -

-with-md5-passwords -mandir=/usr/share/man/

make && make install

若提示:configure: error: PAM headers not found
安裝 pam*   pam-devel 是關鍵
yum -y install pam*

查看sshd運行狀態:
netstat -anptul | grep :22
停掉服務,取消開機啓動:
service sshd stop
chkconfig sshd off


設置環境變量:

echo "export

PATH=/usr/local/openssh/bin:$JAVA_HOME/bin:$PATH " >>

/etc/profile
使其生效:
source /etc/profile

設置sshd開機啓動:

echo " /usr/local/openssh/sbin/sshd " >> /etc/rc.d/rc.local


啓動sshd
/usr/local/opoenssh/sbin/sshd
沒有錯誤提示 [root@localhost ~]# lsof -i:22
查看進程監聽狀態
COMMAND  PID USER   FD   TYPE DEVICE SIZE NODE NAME
sshd    2686 root    3u  IPv6  11222       TCP *:ssh

(LISTEN)
sshd    2686 root    4u  IPv4  11230       TCP *:ssh

(LISTEN)
說明服務已經正常啓動。

查看ssh版本:
[root@localhost ~]# ssh -v
OpenSSH_6.1p1, OpenSSL 1.0.1c 10 May 2012
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address]

[-c cipher_spec]
           [-D [bind_address:]port] [-e escape_char] [-F

configfile]
           [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o

option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S

ctl_path]
           [-W host:port] [-w local_tun[:remote_tun]]
           [user@]hostname [command]
或者:
[root@localhost ~]# telnet localhost 22
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.1


升級完成。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章