阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Linux下升级 OpenSSH

205次阅读
没有评论

共计 1965 个字符,预计需要花费 5 分钟才能阅读完成。

一、下载最新版本 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

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计1965字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中