How to install SSH Server on Ubuntu 18.04 Bionic Beaver Linux

Objective

The objective is to install SSH Server on Ubuntu 18.04 Bionic Beaver Linux

Operating System and Software Versions

  • Operating System: – Ubuntu 18.04 Bionic Beaver

Requirements

Privileged access to your Ubuntu system will be required to perform this installation.

Conventions

  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user

Other Versions of this Tutorial

Ubuntu 20.04 (Focal Fossa)

Instructions

Install prerequisites

This guide will use tasksel to install SSH server. If tasksel is not available on your system you can install it by using the following linux command:

$ sudo apt install tasksel

Install SSH Server

Next, use tasksel to install the openssh-servertask:

$ sudo tasksel install openssh-server

SSH server is now active and will start after reboot:

$ service ssh status
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-01-15 11:59:54 AEDT; 20min ago
  Process: 707 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 714 (sshd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/ssh.service
           └─714 /usr/sbin/sshd -D

Jan 15 11:59:54 ubuntu systemd[1]: Starting OpenBSD Secure Shell server...
Jan 15 11:59:54 ubuntu sshd[714]: Server listening on 0.0.0.0 port 22.
Jan 15 11:59:54 ubuntu sshd[714]: Server listening on :: port 22.
Jan 15 11:59:54 ubuntu systemd[1]: Started OpenBSD Secure Shell server.
Jan 15 12:00:18 ubuntu sshd[797]: Accepted publickey for linuxconfig from 10.1.1.230 port 36076 ssh2: RSA SHA256:NRnW+1Zxjt+TOoWsV//nzqkJo/cbg48/XOr3XDNMqYQ
Jan 15 12:00:18 ubuntu sshd[797]: pam_unix(sshd:session): session opened for user linuxconfig by (uid=0)


Appendix

To stop SSH server execute:

$ sudo service ssh stop

To start SSH server execute:

$ sudo service ssh start

To restart SSH server execute:

$ sudo service ssh restart

To disable SSH server to start during boot execute:

$ sudo systemctl disable ssh

To enable SSH server to start during boot execute:

$ sudo systemctl enable ssh