Loading

CentOS 升级 OpenSSH

OpenSSH 安装包

http://www.openssh.com/portable.html
https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/

查看版本

系统版本

# 记录下面信息,在更新后进行检查
# 主机名
hostname -I
# 系统版本
cat /etc/redhat-release
# SSH版本
ssh -V
# openssl 安装目录
openssl version -a
# 检查依赖包是否已安装 
rpm -qa | grep -E  "zlib-devel|openssl-devel|gcc"

备份OpenSSH

备份需要升级的配置文件

mkdir /etc/ssh.bak
mv /etc/ssh/ /etc/ssh.bak/

升级

上传最新版安装包

tar xf openssh-8.5p1.tar.gz  
cd openssh-8.5p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl --with-md5-passwords 

make && make install

--prefix 安装目录
--sysconfdir 配置文件目录
--with-ssl-dir 指定 OpenSSL 的安装目录
--with-privsep-path 非特权用户的chroot目录
--with-privsep-user=sshd 指定非特权用户为sshd
--with-zlib 指定zlib库的安装目录
--with-md5-passwords 支持读取经过MD5加密的口令
--with-ssl-engine 启用OpenSSL的ENGINE支持

重启SSH

升级后已经要进行重启sshd,不重启的话,你会发现登录显示密码错误

systemctl restart sshd

遇到的错误

configure: error: *** zlib.h missing – please install first or check config.log

 yum install -y zlib-devel

configure: error: *** working libcrypto not found, check config.log

yum install -y openssl-devel

configure: error: no acceptable C compiler found in $PATH

yum install -y gcc

configure: error: *** OpenSSL headers missing – please install first or check config.log

yum install -y openssl-devel
posted @ 2021-03-17 20:35  宋某人  阅读(470)  评论(0编辑  收藏  举报