Ubuntu源码升级升级openssh

# 确认新包已上传
# https://www.openssh.com/releasenotes.html
ll openssh-9.3p2.tar.gz

# 旧版数据
mkdir /root/backup/openssh/ -p
mv /etc/ssh /root/backup/openssh/
mv /etc/pam.d/sshd /root/backup/openssh/etc_pam.d_sshd

# 安装依赖包
apt install -y gcc  make  zlib1g zlib1g-dev libssl-dev  libpam0g-dev
# 卸载旧版
apt-get remove -y openssh-server

# 解压新版
tar xf openssh-9.3p2.tar.gz
cd openssh-9.3p2/

# 预编译新版
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-zlib --with-md5-passwords --with-pam

# 编译
make
# 安装
make install

# 把新版数据备份
mv /etc/ssh/ /root/backup/openssh/ssh-9.3p2
mv /etc/pam.d/sshd /root/backup/openssh/etc_pam.d_sshd_9.3p2

# 还原旧版数据
mv /root/backup/openssh/ssh /etc/ssh
mv /root/backup/openssh/etc_pam.d_sshd /etc/pam.d/sshd

# 解锁 ssh服务
systemctl unmask ssh
# 重启
systemctl restart sshd
# 查看
systemctl  status ssh

# 查看版本
ssh -V
OpenSSH_9.3p2, OpenSSL 1.1.1  11 Sep 2018

参考:Ubuntu20.04 升级openssh9.4(源码升级)_openssh源码下载-CSDN博客

你可能感兴趣的:(ubuntu,linux,运维)