ubuntu2204升级openssh

安装依赖

sh 复制代码
apt update
apt install build-essential zlib1g-dev libssl-dev -y
apt install libpam0g-dev libselinux1-dev libkrb5-dev -y
apt install autoconf -y

mkdir /var/lib/sshd
chmod -R 700 /var/lib/sshd/
chown -R root:sys /var/lib/sshd/

下载最新ssh

sh 复制代码
cd /var/lib/sshd/
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz

编辑安装

sh 复制代码
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/include/openssl --with-ssl-dir=/usr/local/lib --with-zlib --with-md5-passwords --with-pam --with-privsep-path=/var/lib/sshd
sh 复制代码
make && make install

修改配置

如果这里没有允许密码登录,又没有配置免密,那就gg了

根据自己需要调整sshd配置文件,参考如下

sh 复制代码
vim /etc/ssh/sshd_config
sh 复制代码
PermitRootLogin yes                                    #允许root登录,root用户必须添加
AuthorizedKeysFile      .ssh/authorized_keys    #指定公钥文件的保存位置以及名称
PasswordAuthentication yes                             #允许密码验证
UsePAM yes                                                      #PAM模块
UseDNS no                                                        #关闭dns检测

重启ssh

sh 复制代码
systemctl restart ssh

检查版本

sh 复制代码
ssh -V
相关推荐
LSG_Dawn7 小时前
XBOX360 kinect + ROS2_humble
ubuntu·深度相机
jing.wang_20258 小时前
NVIDIA CUDA C++编程环境搭建--Windows + Ubuntu 22.04
c++·windows·ubuntu·gpu算力
黑白园11 小时前
个人台式机VMware 15及Ubuntu 16.04.5卸载以及VMware 16.2.3及Ubuntu 24.04.4安装
linux·ubuntu
想你依然心痛1 天前
从监控数据到告警管理:Prometheus与Alertmanager部署实战
ubuntu·prometheus·内网穿透·系统监控·cpolar·告警管理
黑白园1 天前
解决服务器拒绝连接导致ubuntu镜像无法下载问题 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/
ubuntu
yangpan0111 天前
ubuntu输入法安装及选择
linux·运维·ubuntu
强里秋千墙外道1 天前
Ubuntu 开机 Kernel Panic:HWE 内核升级失败 + NVIDIA DKMS 踩坑实录
linux·运维·ubuntu
啊啊啊迈 旋棍2 天前
【译】TypeScript 7 测试版已在 Visual Studio 2026 18.6 Insiders 3 中默认启用
ubuntu·typescript·visual studio
Eloudy2 天前
ubuntu 22.04安装 cuda 12.8.2
linux·运维·ubuntu
接针2 天前
Pycharm远程连接Ubuntu的conda环境
ubuntu·pycharm·conda