ubuntu 升级openssh9.6p1,zlib1.3,openssl3.2.0


适用版本:
20.04.6 LTS (Focal Fossa)
22.04.3 LTS (Jammy Jellyfish)

其他版本大致一样,未测试。

 

# 卸载openssh

apt-get remove openssh-server openssh-client -y

 

# 更新 APT 软件包列表

apt-get update -y

 

# 安装 libpam0g-dev和gcc

apt-get install libpam0g-dev build-essential -y

 

# 安装zlib

tar -zxvf zlib-1.3tar.gz
./configure --shared
make && make install

 

# 安装OpenSSL

./config shared zlib 
make -j 4 && make install

 

# 备份openssl

mv /usr/bin/openssl /usr/bin/openssl.bak

 

# 从安装位置创建软连接到系统位置

ln -s /usr/local/bin/openssl /usr/bin/openssl

 

# 从用户库创建软链接到openssl安装位置的库目录下(如果目录不存在需要先创建)

ln -s /usr/local/lib64/libssl.so /usr/local/openssl/lib64/libssl.so
ln -s /usr/local/lib64/libssl.so.3 /usr/lib/libssl.so.3
ln -s /usr/local/lib64/libcrypto.so.3 /usr/lib/libcrypto.so.3

 

# 将openssl 的lib 库添加到系统

echo '/usr/local/openssl/lib64' > /etc/ld.so.conf.d/openssl.conf

 

# 使新添加的lib 被系统找到

ldconfig -v

 

# 验证版本

openssl version

 

# 安装openssh

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-ssl-dir=/usr/include/openssl --with-privsep-path=/var/lib/sshd
make -j 4 && make install

 

# 验证版本

ssh -V

 

# 取消SSH服务的解锁状态,重启sshd服务

systemctl unmask ssh
systemctl restart sshd

 

# 修改sshd_config中sftp路径

find / -name sftp-server #找到路径,一般为:/usr/libexec/sftp-server
cat -n /etc/ssh/sshd_config | grep sftp # 找到sftp在配置文件所在的行号
vim /etc/ssh/sshd_config 找到对应的行,把路径替换为刚找到的就行。

 

posted @   剑小秀  阅读(1439)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示