赞
踩
准备工作
在开始升级之前,请确保您已经完成以下准备工作:
/etc/ssh/
目录下的所有配置文件,以防万一升级过程出现问题。cd
、tar
、configure
和 make
。在编译源代码之前,确保安装了编译所需的依赖项。
sudo apt update
sudo apt install build-essential libssl-dev zlib1g-dev
下载 OpenSSH 源代码
使用 wget
命令从 OpenSSH 官方网站下载最新版本的源代码:
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
解压源代码
使用 tar
命令解压下载的源代码包:
tar -zxvf openssh-9.8p1.tar.gz
配置并编译源代码
进入解压后的源代码目录并运行以下命令进行配置和编译:
cd openssh-9.8p1
./configure --prefix=/usr/local --sysconfdir=/etc/ssh
make
安装 OpenSSH
使用 make install
命令将编译好的 OpenSSH 程序安装到系统:
sudo make install
更新 SSHD 配置文件
编辑 /etc/ssh/sshd_config
文件并更新以下配置项:
Protocol 2
Ciphers aes256-ctr,aes128-ctr,aes256-cbc,aes128-cbc,3des-cbc,blowfish-cbc
MACs hmac-sha2-256,hmac-sha2-512,hmac-ripemd160
KexAlgorithms diffie-hellman-group-exchange-sha256
HostKeyAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512
重启 SSHD 服务
使用以下命令重启 SSHD 服务以应用新的配置:
sudo systemctl restart sshd
验证 OpenSSH 版本
使用以下命令检查 OpenSSH 的版本以确认是否已成功升级:
ssh -V
注意事项
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。