Shreyas Jani

I'm a web designer & software engineer based out of Mumbai.

I write about technology & love documenting the world around me through photography.

Install, enable and disable SSH on Ubuntu

25 May 2020

What is SSH?

SSH is a tool for secure system administration, file transfers and other communication across the internet or other untrusted networks. SSH encrypts identities, passwords and transmitted data so that they cannot be eavesdropped and stolen - SSH.com.

OpenSSH is an open source implementation of the SSH protocol.

I've been using an Ubuntu installation on my home laptop and a MacBook for work. SSH has its own uses out in the world, especially if you are managing multiple servers. For me, I use SSH to securely login into my Ubuntu installation and make edits to documents that I don't want to copy to my dropbox folder or to the MacBook, and to view contents of a directory.

In the past, I've used SSH to login into our staging server to deploy the changes I made to my code and stage those for the product managers and designers. The logging in to a server caught my fancy and got me wondering if I could implement a very basic SSH login on my Ubuntu installation.

Install and enable SSH

To install and enable SSH on your Ubuntu machine, we need to install the openssh-server package by running → sudo apt update. Enter the password and run the following command. → sudo apt install openssh-server.

While the SSH service will start automatically once the installation is complete, we can verify that by running the following command → sudo systemctl status ssh which should print the SSH server status as Active: active (running). If you have firewall enabled on your system, make sure to open the SSH port by using the ufw configuration tool in Ubuntu → sudo ufw allow ssh.

This is how you can enable SSH on your machine and remotely access it as well.

Disabling and enabling SSH

To disable SSH on your machine, run → sudo systemctl stop ssh and enable it by running → sudo systemctl start ssh.

You can disable SSH service to start during system boot by running → sudo systemctl disable ssh and enable it by running → sudo systemctl enable ssh.