手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux下升级 OpenSSH

[日期:2017-03-31] 来源:Linux社区  作者:meiling [字体:大 中 小]

一、下载最新版本 OpenSSH
OpenSSH 的官方网站:http://www.openssh.com
这里我下载的是openssh-6.2p1
使用ssh -V 命令查看一下
wKiom1O0uAzS7ME5AAKIaP4gKZ8241.jpg
#安装相关的组件
yum -y install gcc openssl-devel pam-devel rpm-build

二、下面开始升级SSH,这里我写了两种升级方法
1、编译安装 OpenSSH
# tar xzvf openssh-6.2p1.tar.gz
# cd openssh-6.2p1
# ./configure --prefix=/usr --sysconfdir=/etc/ssh

下载的是源码包要编译一下,注意我的编译路径,我是讲OPENSSH安装在原来的路径下,这样后面安装完成后就不用在重新copy SSHD服务到/etc/init.d/下了!,可以根据实际情况定制安装路径。
make
mv /etc/ssh/* /etc/sshbak/ 
由于我使安装在原路径下,所以我将旧的配置文件挪了一下位置,不然make install 会报错!
make install

/etc/init.d/sshd restart       
这里注意安全,如果你前面编译报错了,还强制安装,SSHD服务可能就起不来了

chkconfig --add sshd 
chkconfig sshd on

重启过SSH服务后,查看版本
[root@linuxidc ~]$ ssh -v
OpenSSH_6.2p1, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
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]

已经成功升级至6.2版本!

2、rpm包安装
编译源程序为 RPM 安装包
cp /root/openssh-6.2p1/contrib/RedHat/openssh.spec /usr/src/redhat/SPECS/
 
cp openssh-6.2p1.tar.gz /usr/src/redhat/SOURCES/
 
cp x11-ssh-askpass-1.2.4.1.tar.gz /usr/src/redhat/SOURCES/
 
perl -i.bak -pe 's/^(%define no_(gnome|x11)_askpass)\s+0$/$1 1/' openssh.spec    //备份这个文件
 
rpmbuild -bb openssh.spec    //制作生成rpm包

安装编译好了的 RPM 包
cd /usr/src/redhat/RPMS/`uname -i`
rpm -Uvh openssh*rpm

更多OpenSSH相关内容可以查看以下的有用链接: 

在Ubuntu Server 13.10系统中安装配置OpenSSH http://www.linuxidc.com/Linux/2014-02/96953.htm

Ubuntu安装远程登录OpenSSH服务 http://www.linuxidc.com/Linux/2014-02/97218.htm

CentOS 6下OpenSSH 5.3升级至7步骤记录 http://www.linuxidc.com/Linux/2016-11/137166.htm

OpenSSH普通用户无法登录的几种情况的解决方法 http://www.linuxidc.com/Linux/2012-05/59457.htm

通用线程: OpenSSH 密钥管理,第 1 部分理解 RSA/DSA 认证 http://www.linuxidc.com/Linux/2011-08/39871.htm

RedHat安装OpenSSH和配置sftp锁定目录 http://www.linuxidc.com/Linux/2012-12/75398.htm

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-03/142411.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款