本文系作者原创,转载请保留出处:http://marion.cublog.cn
一、关闭并卸载RedHat9.0自带的Openssh
1.1 停止服务
#service sshd stop
1.2 卸载Openssh
#rpm -e openssh --nodepsfmLLinux联盟
#rpm -e openssh-server --nodepsfmLLinux联盟
#rpm -e openssh-clients --nodepsfmLLinux联盟
#rpm -e openssh-askpass-gnomefmLLinux联盟
#rpm -e openssh-askpass
二、下载安装最新的openssl和openssh
2.1 下载相关软件包至/usr/local/src目录
2.2 安装openssl
#cd /usr/local/srcfmLLinux联盟
#tar zxvf openssl-0.9.8e.tar.gzfmLLinux联盟
#cd openssl-0.9.8efmLLinux联盟
#./config shared zlibfmLLinux联盟
#make fmLLinux联盟
#make testfmLLinux联盟
#make installfmLLinux联盟
mv /usr/bin/openssl /usr/bin/openssl.OFFfmLLinux联盟
mv /usr/include/openssl /usr/include/openssl.OFFfmLLinux联盟
ln -s /usr/local/ssl/bin/openssl /usr/bin/opensslfmLLinux联盟
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
2.3 配置库文件搜索路径
#echo "/usr/local/ssl/lib" >> /etc/ld.so.conffmLLinux联盟
#ldconfig -vfmLLinux联盟
fmLLinux联盟
2.4 查看openssl的版本号,以验正是否安装正确
#openssl version -afmLLinux联盟
OpenSSL 0.9.8e 11 Apr 2007fmLLinux联盟
built on: Sat Mar 24 21:24:41 CST 2007fmLLinux联盟
platform: linux-elffmLLinux联盟
options: bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) blowfish(idx) fmLLinux联盟
compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DSHA1_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASMfmLLinux联盟
OPENSSLDIR: "/usr/local/ssl"
三、下载安装最新的openssh
3.1 下载相关软件包至/usr/local/src目录
3.2 安装
#cd /usr/local/srcfmLLinux联盟
#tar zxvf openssh-4.6p1.tar.gzfmLLinux联盟
#cd openssh-4.6p1fmLLinux联盟
#./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-ssl-dir=/usr/local/ssl --with-md5-passwords --mandir=/usr/share/man fmLLinux联盟
#make fmLLinux联盟
#make install
3.3 查看openssh版本号,验正安装结果
# ssh -vfmLLinux联盟
OpenSSH_4.6p1, OpenSSL 0.9.8e 11 Apr 2007fmLLinux联盟
usage: ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]fmLLinux联盟
[-D [bind_address:]port] [-e escape_char] [-F configfile]fmLLinux联盟
[-i identity_file] [-L [bind_address:]port:host:hostport]fmLLinux联盟
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]fmLLinux联盟
[-R [bind_address:]port:host:hostport] [-S ctl_path]fmLLinux联盟
[-w local_tun[:remote_tun]] [user@]hostname [command]
四、启动并验正服务的开启状况
4.1 启动服务
#/usr/sbin/sshd
4.2 查看监听端口中是否有22
#netstat -tnlp | grep :22fmLLinux联盟
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 21018/sshd
4.3 尝试从本机通过ssh登录
# ssh
root@localhostfmLLinux联盟The authenticity of host 'localhost (127.0.0.1)' can't be established.
fmLLinux联盟RSA key fingerprint is 03:eb:80:fe:07:d9:9d:00:1c:15:37:93:d1:d3:8e:6d.
fmLLinux联盟Are you sure you want to continue connecting (yes/no)? yes
fmLLinux联盟Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
fmLLinux联盟root@localhost's password:
fmLLinux联盟Last login: Wed Apr 11 11:29:04 2007 from localhost.localdomain
fmLLinux联盟