How to enable ssh on Ubuntu 18.04/19.10/20.04

In this article, you will learn about how to enable ssh on Ubuntu?

I’m going to tell you that how can you access ssh on Ubuntu version 18.04, 19.10, or Ubuntu 20.04. SSH stands for Secure Shell. It is a protocol to connect one computer from another computer securely. SSH uses strong encryption to protect the information with secure communication and also make sure integrity. I’m not going in-depth here.

How to Install OpenSSH in Ubuntu 18.04/19.10/20.04

There is already installed OpenSSH client package in Ubuntu, but if you want to access the system through ssh, then you have to install the ssh-server package. Now we are going to use the below command to install the OpenSSH server package.

Step 1: Opening the terminal window

Open the Terminal, there are two ways to open the Terminal, First, click on Show Applications menu, you will get the list of applications. here, search for Terminal and click on it to open it. Second, press Ctrl+Alt+T and it will open the terminal.

Step 2: Installing the OpenSSH software package

Now the terminal has been open, type the below command to update the package information, and then type the command to install the openssh server package.

sudo apt update
sudo apt install openssh-server

It will prompt for your sudo user password, enter the password. Press y to accept the condition and then press Enter key. It will install the ssh package.

Step 3: Editing the configuration file

After successful installation, you can open the configuration file to change the listening port, root access. The default configuration file located at /etc/ssh/sshd_config.
I’m going to use vim editors to open it but you can use gedit or nano because these are by default installed in Ubuntu. To open it,

sudo vim /etc/ssh/sshd_config

Step 4: Starting the SSH service

Here, we are going to start the ssh service, use the below command to start it.

sudo systemctl start ssh

You can check the status of ssh by typing the below command.

sudo systemctl status ssh
enable ssh on Ubuntu
checking status of ssh

Managing the SSH service

Some other commands to restart, stop, enable, disable.

If you want to restart the ssh service the use the below command,

sudo systemctl restart ssh

This is the way to enable it on startup

sudo systemctl enable ssh

If you want to stop the service then you can follow the below step.

sudo systemctl stop ssh

If you want to disable from startup, use the below command.

sudo systemctl disable ssh

To check, if it is disabled on startup or not,

sudo systemctl is-enabled ssh 

Conclusion

In this tutorial, you learned about enable the ssh on Ubuntu. I hope, you understand, but if you have any questions, you can ask in the comment section.

Also, you can read further.

Leave a Reply