Ubuntu Linux install OpenSSH server

September 8, 2019

How do I install OpenSSH server on Ubuntu Linux?

Introduction: sshd (OpenSSH Daemon or server) is the daemon program for ssh client. It is a free and open source ssh server. ssh replaces insecure rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network such as the Internet. Ubuntu Desktop and minimal Ubuntu server do not come with sshd installed. However, you can easily install SSH server in Ubuntu using the following steps.

How to install SSH server in Ubuntu

The procedure to install a ssh server in Ubuntu Linux is as follows:

  1. Open the terminal application for Ubuntu desktop.
  2. For remote Ubuntu server you must use BMC or KVM or IPMI tool to get console access
  3. Type sudo apt-get install openssh-server
  4. Enable the ssh service by typing sudo systemctl enable ssh
  5. Start the ssh service by typing sudo systemctl start ssh
  6. Test it by login into the system using ssh [email protected]

Let us see all Ubuntu OpenSSH server installation steps in details.

1. Login to remote server using bmc/ipmi/kvm over IP (optional)

I am using OpenPOWER based system called Talos II from Raptor Computing Systems. It is a PowerPC (ppc/ppc64le) based architecture. After a fresh installation of Ubuntu Linux (ppc64le), I found does not come with SSH server installed by default. So here is how to login to bmc server to gain access to the serial console:
$ ssh [email protected]
Run obmc-console-client to get console access to the Ubuntu server console:
# obmc-console-client

2. Ubuntu Linux install OpenSSH server

First update the system using the apt command or apt-get command:
$ sudo apt update
$ sudo apt upgrade

To install openssh-server package, run:
$ sudo apt install openssh-server

Click to enlarge an image

3. Verify that ssh service running

Type the following systemctl command:
$ sudo systemctl status ssh

If not running enable the ssh server and start it as follows:
$ sudo systemctl enable ssh
$ sudo systemctl start ssh

Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service ? /lib/systemd/system/ssh.service.

Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service ? /lib/systemd/system/ssh.service.

4. Configure firewall and open port 22

You must configure the Ubuntu Linux firewall called ufw. Here is how open or allow port 22 when using ufw on Ubuntu:
$ sudo ufw allow ssh
$ sudo ufw enable
$ sudo ufw status

5. Test it

Now you can login from your desktop computer powered by Linux, *BSD, macOS, MS-Windows (putty client) or Unix-like system using the ssh command:
$ ssh [email protected]
$ ssh [email protected]

You can install copy and install the public key using ssh-copy-id command for password less login:
$ ssh-copy-id [email protected]
See “SSH Public Key Based Authentication on a Linux/Unix server” for more info.


In this tutorial, you learn how to install the OpenSSH server application at a terminal prompt. Although instructions tested for Power9 (ppc64le) architecture, they should work on Intel AMD64 or ARAM64 server as well. For more info see OpenSSH home page here and how to secure OpenSSH server tutorial here.

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Article Tags:
Article Categories:
How To

Comments are closed.