How to Install OpenSSH Server from Source in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

9 Responses

  1. Madhu says:

    Although if you compile and install 7.9 successfully, this will not replace the existing sshd bin file (you can check with ssh -v localhost) , don’t know what’s the reason, but i had to rsync the compiled bin file to the existing sshd.

    OS: Ubuntu 18.04 LTS

    See the difference

    [email protected]:/home/it# /usr/local/sbin/sshd -V
    unknown option -- V
    OpenSSH_7.9p1, OpenSSL 1.1.0g  2 Nov 2017
    usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]
                [-E log_file] [-f config_file] [-g login_grace_time]
                [-h host_key_file] [-o option] [-p port] [-u len]
    [email protected]:/home/it# /usr/sbin/sshd -V
    unknown option -- V
    OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
    usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]
                [-E log_file] [-f config_file] [-g login_grace_time]
                [-h host_key_file] [-o option] [-p port] [-u len]

    I did rsync with below command (note: backup sshd bin file before you replace)

    # rsync -avP /usr/local/sbin/sshd /usr/sbin/sshd

    and then when i connect to ssh with debug (-v) it shows correct 7.9 version!.

    Just a doubt: is this way correct or anything more should be done?.

  2. Miro says:

    On Ubuntu 18.04 when enabling selinux and PAM throws errors :

    configure: error: SELinux support requires selinux.h header
    configure: error: PAM headers not found

    Needs this additionally installed:

    # apt install libselinux1-dev libpam0g-dev
  3. atomick says:

    one other caveat on linux there appears to be no prngd generator there is no info as to using replacement on Linux when working this type of additional number and cipher picks. Nice to see many methods and info towards this. It is hard finding a syntax example that works correctly.

  4. atomick says:

    I did manage to compile openssh-7.9p1 along with openssl and zlib. also without SElinux option or –sysconfdir=/etc/ssh – that didn’t seen to matter for the compile step – most likely I’m missing parts for correct compiling tools and library resource be my only thought to still seeing misses on the final ending.

    Work in progress – resorting to a Virtual Guest to attempt better learning steps. working to order logic zlib 1st openssl 2nd and openssh 3rd to raw compile. – BIG on my List to Wana Know is make clean and or “Re- runs to recompile and know I can remove my previous attempt to compile files and Start again. So when finally click with the right commandline and resources the end result will not be bloated scrap files around my system. ?

  5. atomick says:

    possibly only caveat I may ask of – is For what Starting Directory should this Process be started from – if existing ssh version is already installed – i.e: in one form where should could the openssh*.tar.gz “tarball” go to work this – ~/username/temp dir or /tmp system directory and apt-get Newest Version of openssh and have it be downloaded and gunzip’d there ?

  6. Adrian says:

    I had errors installing it, and had to remove “–with-selinux”

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.