You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Ubuntu 22.04.2 LTS环境下升级OpenSSH从v8.9到v9.3的方法咨询

Ubuntu 22.04.2 LTS环境下升级OpenSSH从v8.9到v9.3的方法咨询

Hey there! Great question—this is a super common scenario with Ubuntu LTS releases, where stability takes priority over cutting-edge package versions, so newer OpenSSH releases like 9.3 don’t land in the official Jammy repos by default. Let’s walk through your reliable options to get that upgrade done:

Why you don’t see OpenSSH 9.3 in official repos

Ubuntu 22.04 (Jammy Jellyfish) ships with OpenSSH 8.9p1 as part of its stable package lineup. LTS releases lock in package versions for the support cycle, only backporting critical security fixes instead of pushing full version upgrades. That’s why 9.3 isn’t available out of the box.

Option 1: Compile OpenSSH from source (most control)

This gives you full control over the build and avoids relying on third-party packages. Just follow these steps carefully:

  • First, install the dependencies needed for compiling:
    sudo apt update && sudo apt install build-essential zlib1g-dev libssl-dev libpam0g-dev libkrb5-dev
    
  • Critical backup step: Save your current SSH config and binaries in case something goes wrong:
    sudo cp /usr/sbin/sshd /usr/sbin/sshd.backup && sudo cp -r /etc/ssh /etc/ssh.backup
    
  • Grab the OpenSSH 9.3 source archive, extract it, and navigate into the directory:
    tar xzf openssh-9.3p1.tar.gz && cd openssh-9.3p1
    
  • Configure the build with options that match Ubuntu’s default setup (preserving PAM, Kerberos, and zlib support):
    ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-kerberos5 --with-zlib
    
  • Compile and install the new version:
    make && sudo make install
    
  • Verify the upgrade worked:
    ssh -V && sshd -V
    
  • Restart the SSH service to apply the changes:
    sudo systemctl restart sshd
    
  • Pro tip: Keep a second terminal session open while doing this—if something breaks the SSH service, you’ll still have access to fix it. Also, note that future system updates won’t overwrite this compiled version, so you’ll need to recompile if you want to upgrade again later.

Option 2: Use a trusted third-party PPA (easiest)

If compiling feels too hands-on, a well-maintained PPA can get you the newer version with minimal effort. Just a heads-up: only use PPAs from sources you trust, since third-party repos can introduce security risks if not properly maintained.

  • Add the reputable PPA that offers OpenSSH 9.3 for Ubuntu 22.04:
    sudo add-apt-repository ppa:<trusted-ppa-name>
    
  • Update your package list to pull in the PPA’s packages:
    sudo apt update
    
  • Upgrade your OpenSSH server and client:
    sudo apt install openssh-server openssh-client
    
  • Verify the version and restart the service as you would with the source method.

Key post-upgrade checks

  • Run sudo sshd -t to check for any configuration errors—OpenSSH 9.3 might have deprecated some older options in /etc/ssh/sshd_config.
  • Test SSH access from another machine before closing your current session to ensure you don’t get locked out.
  • If you run into issues, restore your backup files and roll back to the original version.

备注:内容来源于stack exchange,提问作者Kat Fitzgerald

火山引擎 最新活动