Objective

The below guide will provide you with information on how to enable ssh on Ubuntu 18.04 Linux. SSH stands for secure shell which allows encrypted remote login connections between client and server over insecure network.

Operating System and Software Versions

  • Operating System: - Ubuntu 18.04 Bionic Beaver
  • Software: - OpenSSH 7.5 or higher

Requirements

Privileged access to your Ubuntu System as root or via sudo command is required.

Difficulty

EASY

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

Instructions

Enable SSH on Ubuntu

In order to enable ssh on Ubuntu Linux, we first need to perform an SSH package installation. Open up terminal and enter command:
$ sudo apt install ssh
Install ssh on Ubuntu 18.04
To enable SSH on Ubuntu, first install SSH package.
Confirm that SSH server is up and running by executing the bellow command. Look for keyword Active: active (running). Press q if you need to get your command line prompt back:
$ service ssh status
SSH enabled on ubuntu 18.04
SSH is now enabled and listening on port 22.
At this stage you should be able to login from this host to any other SSH enabled Ubuntu server. For example, to login to server with host name ubuntu-server as user linuxconfig enter:
$ ssh linuxconfig@ubuntu-server
Warning:By default you will not be able to login using SSH remote connection as a root user. Follow our guide on how to allow SSH root login on Ubuntu Linux.


Enable/Disable SSH on Ubuntu

In an event that you need to temporarily disable SSH on your Ubuntu host execute:
$ sudo service ssh stop
To start again run:
$ sudo service ssh start
Starting and Stopping SSH service on Ubuntu 18.04
Starting and Stopping SSH service on Ubuntu 18.04
In order to completely disable SSH after reboots execute:
$ sudo systemctl disable ssh
To enable SSH again on your Ubuntu host use command:
$ sudo systemctl enable ssh
Disable and Enable SSH on Ubuntu 18.04
Disable and Enable SSH on Ubuntu 18.04
ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME or create a JOB ALERT on LinuxCareers.com job portal.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.