Top

Enabling SSH on Ubuntu 18.04

Posted in Technology Bites on Nov 14, 2019

613

That’s great. Finally, you decided to have Ubuntu for your desktop OS?

Now one question might be bothering you..!

How do I install the OpenSSH server on Ubuntu/Linux?

For Ubuntu beginners, this quick tutorial of Sopehosts will show you how to enable the SSH(Secure Shell) service on Ubuntu 18.04.

When establishing a remote connection between the server and a client, the prime concern is ensuring security for the server. For Linux/Ubuntu users, the best practice of managing & accessing the server remotely is through the cryptographic protocol known as Secure Shell (SSH).

Firstly, Let’s discuss on SSH

SSH(Secure Shell) - The cryptographic network protocol that encrypts all the data been transferred from one machine to another, making sure that no sensitive information is compromised during the process.

As a desktop client, you can safely run a command line, transfer files, secure network services, and much more.

Prerequisites

  • Before you begin the installation, you need to be logged in as a root user or a user with sudo privileges.

  • Permissions to access the remote computer.

  • OpenSSH 7.5 or higher version

  • Access to a terminal/command line


Steps For Enabling SSH on Ubuntu

Step 1: Open terminal using Ctrl+Alt+T or Windows button on the keyboard followed by alphabet t and hit Enter or by searching for “Terminal” from software launcher.

Step2: Execute the following commands on terminal

**$ sudo apt update**
**$ sudo apt install openssh-server**

Enter the password when prompted and hit ENTER. Type Y to continue with the installation process.

Step3: The installation is completed, to check that ssh was successful use the below command

**$ sudo systemctl status ssh**

The confirmation message that you are looking for is: Active: active (running)

Press q to get back to the command line prompt.

Step4: You are done with the installation, you can connect through Linux and macOS systems as they have SSH installed by default, for windows you can access it by downloading PuTTY.


Configure OpenSSH:

To change the SSH setting, e.g., run command, root access, listening port:

**$ sudo gedit /etc/ssh/sshd_config**

The command opens the configuration file via Gedit (For Ubuntu Server you may use nano instead).

And remember to restart SSH service to apply changes:

**$ sudo systemctl restart ssh.service**

Note: By default, SSH listens on port 22. Changing the default SSH port adds an extra layer of security to your server by reducing the risk of automated attacks.


Disabling SSH on Ubuntu:

If for some reason you want to disable SSH on your Ubuntu machine you can simply stop the SSH service by running:

**$ sudo systemctl stop ssh**

Alternatively to start the SSH service again.

**$ sudo systemctl start ssh**

Or if you need to disable the SSH service to start during system boot run:

**$ sudo systemctl disable ssh**

Also to enable it again use the next command.

**$ sudo systemctl enable ssh**

And you’re set to go!

We hope you understood how to enable SSH on Ubuntu and found this tutorial helpful. You can now login to your machine and perform common sysadmin tasks through the command prompt & can establish a reliable and secure protocol between you and a remote device.

It is easy to install SSH all you need to do is follow the steps in the correct manner. If you have any comments, please feel free to leave them in the comments section below!

Sudha Kothapalli Author: Sudha Kothapalli Digital Marketing Executive and a learner with an ongoing curiosity to learn New Social Media techniques, writes about Digital Marketing and Technology Trends Follow Us: