Ubuntu 22.04 升级openssh至最新版
1. 安装依赖包
sudo apt update
sudo apt install build-essential zlib1g-dev libssl-dev -y
sudo apt install autoconf -y
2. 创建sshd文件夹
sudo mkdir /var/lib/sshd
sudo chmod -R 700 /var/lib/sshd/
sudo chown -R root:sys /var/lib/sshd/
3. 下载openssh最新版
下载地址
选择最新版本下载,这里选择9.7
sudo -i
cd /var/lib/sshd/
wget /pub/OpenBSD/OpenSSH/portable/openssh-9.
4. 解压并安装
sudo tar -zxf openssh-portable-V_9_3_P2.
cd openssh-9.7p1/
sudo autoreconf
sudo apt install libpam0g-dev libselinux1-dev libkrb5-dev -y
sudo ./configure --with-kerberos5 --with-md5-passwords --with-pam --with-selinux --with-privsep-path=/var/lib/sshd/ --sysconfdir=/etc/ssh
sudo make
sudo make install
5. 重启ssh并查询
sudo systemctl restart ssh
sudo systemctl status ssh
ssh -V
sshd -v