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
相关推荐
我是哈哈hh21 小时前
【MySQL】在UBuntu环境安装以及免密码登录入门
linux·数据库·mysql·ubuntu
clever1012 天前
在ubuntu系统上离线安装jenkins的做法
ubuntu·servlet·jenkins
Nie_Xun2 天前
ubuntu网络共享
linux·运维·ubuntu
wuicer3 天前
ubuntu 20.04 安装anaconda以及安装spyder
linux·运维·ubuntu
shuangrenlong3 天前
ubuntu更新chrome版本
linux·chrome·ubuntu
基于python的毕设3 天前
C语言栈的实现
linux·c语言·ubuntu
穷人小水滴3 天前
在 windows 运行 flatpak 应用 (WSL)
linux·windows·ubuntu
mit6.8243 天前
ubuntu远程桌面很卡怎么解决?
linux·ubuntu·php
morliz子轩4 天前
基于WSL搭建Ubuntu 22.04.x LTS开发环境
linux·运维·ubuntu
路多辛4 天前
Debian新一代的APT软件源配置文件格式DEB822详解
linux·运维·ubuntu·debian