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
相关推荐
木心术17 小时前
TypeScript实战进阶:从基础类型到高级类型编程
javascript·ubuntu·typescript
sheeta199811 小时前
TypeScript references 配置与 emit 要求详解
javascript·ubuntu·typescript
ancktion12 小时前
ubuntu多gcc版本切换
linux·运维·ubuntu
贵沫末13 小时前
Claude Code使用
ubuntu
DeepHacking14 小时前
Ubuntu 22.04 安装 Allow Locked Remote Desktop 扩展:解决锁屏后 mstsc 无法连接的问题
linux·运维·ubuntu
成为你的宁宁15 小时前
【apt update突然报错Temporary failure resolving ‘cn.archive.ubuntu.com‘】
linux·运维·ubuntu
SilentSamsara1 天前
SSH 远程管理:密钥登录 + 隧道转发,一次性配置好
linux·运维·服务器·ubuntu·centos·ssh
xuanwenchao1 天前
Mac M1/M2/M3/M4/M5芯片-系统安装Ubuntu
linux·ubuntu·macos
叫我刘同学1 天前
腾讯云 Ubuntu 服务器部署 Hermes Agent 详细安装教程
服务器·ubuntu·腾讯云
fzil0011 天前
让 AI 自己协作 —— 多智能体(Swarm)系统的设计与实现
java·开发语言·人工智能·ubuntu