升级OPenssh到OpenSSH_6.1p1
一、开启telnet,防止ssh中断后无法远程连接服务器。
#vi /etc/xinetd.d/krb5-telnet把yes该为no,
# /etc/init.d/xinetd start
加载windows的共享盘到Linux中
mount -t cifs -o user=hjyang //10.70.116.109/hjyang /mnt
二、关闭并卸载Redhat自动的Openssh
1.1停止服务
# service sshd stop
1.2卸载Openssh
#rpm -e openssh --nodeps
#rpm -e openssh-server --nodeps
#rpm -e openssh-clients --nodeps
#rpm -e openssh-askpass-gnome
#rpm -e openssh-askpass
三、编译安装Zlib
# tar xzvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure --prefix=/usr/local/zlib
# make
# make install
这样,就把zlib编译安装在
/usr/local/zilib中了。
四、下载安装最新的openssl
4.1下载相关软件包到/usr/local/src目录
4.2安装openssl
#cd /usr/local/src
#tar zxvf openssl-1.0.1e.tar.gz
#cd openssl-1.0.1e.tar.gz
#./config shared zlib
#make
#make test
#make install
mv /usr/bin/openssl /usr/bin/openssl.OFF
mv /usr/include/openssl /usr/include/openssl.OFF
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
4.3配置库文件搜索路径#echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
#ldconfig -v
4.4查看openssl的版本号,以验正是否安装正确
#openssl version -a
OpenSSL 1.0.1e 11 Feb 2013
built on: Thu Feb 28 09:55:33 CST 2013
五、下载安装最新的openssl
5.1下载相关软件包到/usr/local/src目录
5.2安装
#cd /usr/local/src
#tar zxvf openssh-6.1p1.tar.gz
#cd openssh-6.1p1.tar.gz
./configure --prefix=/usr --with-pam --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/openssl-0.9.7e --with-md5-passwords --mandir=/usr/share/man
(注意,如果configure时提示PAM有错误,那一般是因为系统中没有安装pam-devel RPM包,找到安装光盘,安装pam-devel就可以解决啦)
#make
#make install
5.3查看openssh版本号,验正安装结果# ssh -v
OpenSSH_6.1p1, OpenSSL 1.0.1e 11 Feb 2013
六、启动并验证服务的开启状况
6.1调试启动,如果一下显示均正常,就可以正常启动sshd了。
# /usr/sbin/sshd–d
debug1: sshd version OpenSSH_6.1p1
debug1: private host key: #0 type 0 RSA1
debug1: read PEM private key done: type RSA
debug1: private host key: #1 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #2 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
socket: Address family not supported by protocol
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
Generating 768 bit RSA key.
RSA key generation complete.
6.2启动服务
# /usr/sbin/sshd
6.3查看监听端口中是否有22
# netstat -tnlp | grep :22
tcp00 0.0.0.0:220.0.0.0:*LISTEN18133/sshd
tcp00 :::22:::*LISTEN18133/sshd
6.4尝试从本机通过ssh登录
#ssh root@localhost
七、关闭telnet
#vi /etc/xinetd.d/krb5-telnet把no该为yes,
# /etc/init.d/xinetd stop
关闭telnet.