一、ubuntu下openssh升级

安装依赖

sudo apt update 更新库
sudo apt install zlib1g libpam0g-dev  libssl-dev

二、升级ssl,见本博客

https://blog.csdn.net/qq_42430287/article/details/125539316

三、升级openssh

备份原文件
mv /etc/init.d/ssh /etc/init.d/ssh.old
cp -r /etc/ssh /etc/ssh.old
# 卸载原openssh
apt-get remove openssh-server openssh-client
tar xf openssh-9.0p1.tar.gz
cd openssh-9.0p1 
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-ssl-dir=/usr/local/ssl --with-privsep-path=/var/lib/sshd
make 
make install 
查看版本
ssh -V

四、升级完成,更换配置文件

1. 修改默认配置文件

根据之前配置修改,保证配置相同

2. 也可使用原来的配置文件

cd /etc/ssh
mv sshd_config sshd_config.default
cp …/ssh.old/sshd_config ./

3.使用原来的/etc/init.d/ssh

mv /etc/init.d/ssh.old /etc/init.d/ssh

4.取消注销指定服务

systemctl unmask ssh

5.重启服务

systemctl restart ssh

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐