Ubuntu升级ssh版本到9.8

方案一:实测只有8.9有漏洞不推荐

1、更新软件包列表

sudo apt update

2、查找可用版本

apt-cache policy openssh-server

3、 选择版本

sudo apt install openssh-server=1:9.8p1-<具体版本号>

4、 重启

sudo systemctl restart ssh

5、验证版本

/usr/sbin/sshd -V

方案二:推荐

1、安装依赖

sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libncurses5-dev libsqlite3-dev libgdbm-dev libdb-dev libexpat-dev libpcap-dev openssl

2、下载源码

wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz

3、解压

tar -xzf openssh-9.8p1.tar.gz
cd openssh-9.8p1

4、配置编译选项

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-ssl-dir=/usr/lib/x86_64-linux-gnu/

5、编译

make

6、备份

/etc/ssh/sshd_config

/etc/ssh/ssh_config

7、安装

sudo make install

8、重启

sudo systemctl restart ssh

9、验证

/usr/sbin/sshd -V

可能出现的错误

configure: error: PAM headers not found

1、原因

系统缺少PAM(Pluggable Authentication Modules)开发库和头文件。PAM是Linux系统中用于认证的重要模块,因此在编译某些软件时需要它的支持。

2、解决

sudo apt install libpam0g-dev
cd openssh-9.8p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-ssl-dir=/usr/lib/x86_64-linux-gnu/

相关推荐
再难也得平12 小时前
Linux初级篇
linux·运维·服务器
小猫挖掘机(绝版)13 小时前
通过tailscale实现一台电脑上vscode通过ssh连接另一台电脑上的VMware Linux 虚拟机
linux·windows·vscode·ubuntu·ssh
attitude.x13 小时前
Swift 协议扩展与泛型:构建灵活、可维护的代码的艺术
运维·服务器·网络
专注VB编程开发20年14 小时前
rust语言-对象多级访问
服务器·前端·rust
方先森有点懒14 小时前
CentOS 7.2 虚机 ssh 登录报错在重启后无法进入系统
linux·运维·centos·ssh
shylyly_14 小时前
Linux->日志的实现
linux·运维·服务器
m0_7492999514 小时前
Nginx主配置文件
java·服务器·nginx
剑客的茶馆14 小时前
新服务器从0开始搭配Ubuntu+Conda+Docker+Dify
服务器·ubuntu·docker·conda·dify
Hi2024021715 小时前
基于阿里云ECS搭建Tailscale DERP中继服务器:提升跨网络连接速度
服务器·阿里云·云计算
喜欢你,还有大家15 小时前
SSH服务远程安全登录
运维·安全·ssh