Skip to main content

Command Palette

Search for a command to run...

How to compile and install OpenSSH binary on Linux

Published
2 min read
How to compile and install OpenSSH binary on Linux
M

Hey, I'm a postgraduate in Cyber Security with practical experience in Software Engineering and DevOps Operations. The top player on TryHackMe platform, multilingual speaker (Kazakh, Russian, English, Spanish, and Turkish), curios person, bookworm, geek, sports lover, and just a good guy to speak with!

Overview:

OpenSSH (also known as OpenBSD Secure Shell) is a suite of secure networking utilities based on the Secure Shell (SSH) protocol, which provides a secure channel over an unsecured network in a client–server architecture. (from Wikipedia)

OpenSSH is not a single computer program, but rather a suite of programs that serve as alternatives to unencrypted protocols like Telnet and FTP.

Sometimes you need to have a newer or older version of OpenSSH installed on your system. This article shows how to do it manually by downloading and compiling the source code.

Installation was tested on Ubuntu 20.04 system

Installation:

  1. To check your current installed version of OpenSSH use:
    ssh -V
    
  2. Update repository and download required dependencies:
    sudo apt update
    sudo apt install build-essential zlib1g-dev libssl-dev
    
  3. Download the OpenSSH source code from here:
    wget -c https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-[version].tar.gz
    
    The latest version as of writing is 9.1p1
    wget -c https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz
    
  4. Unarchive the source code files:
    tar -xzf openssh-9.1p1.tar.gz
    cd openssh-9.1p1/
    
  5. To check all custom configurable options use:
    ./configure -h
    
  6. To install with default options use:
    ./configure
    make
    sudo make install
    
  7. Example of installation with specific options:
    ./configure --with-kerberos5 --with-md5-passwords --with-pam --with-selinux --with-privsep-path=/var/lib/sshd/ --sysconfdir=/etc/ssh
    
  8. Check the installation:
    ssh -V
    

Reference:

  1. OpenSSH installation CDN
  2. Is possible to upgrade openssh-server OpenSSH_7.6p1, to OpenSSH_8.0p1?
  3. How to Install OpenSSH 8.0 Server from Source in Linux

More from this blog

M

Maxat Akbanov's blog

259 posts

Postgraduate in Cyber Security with experience in Software Engineering and DevOps Operations.