Blog Post
How to Enable Secure Shell (SSH) on Ubuntu Linux

How to Enable Secure Shell (SSH) on Ubuntu Linux

You want to do everything in your power to ensure that the client-server connections you make are secure. That is why you should consider enabling SSH on Ubuntu. It is a network protocol known as Secure Shell that should keep the highest level of security for making this type of connections. In this guide, we are investigating how to enable SSH on Ubuntu.

What You Need to Know Before Enabling SSH on Ubuntu

Only the users with root account or superuser permission can perform the commands mentioned in this article. Make sure that you have the required permissions or log in as the root user. If you forgot your root account password you can always learn how to reset a user password in Linux.

How to Enable SSH on Ubuntu

Although SSH does not come pre-installed with Ubuntu, you can find the installation in the official repository.

Open your terminal and type in the following commands to start the installation:

apt-get update
apt-get install openssh-server

You may be asked to enter the account password to approve the installation.

If you want to confirm that SSH service was installed correctly, run the following command:

systemctl status ssh

The service will automatically start as soon as you install it, which means that the system should display a message that SSH is running (is active).

how to enable ssh on ubuntu

Once the installation has completed, you can use any other remote machine to connect to your system. Linux and macOS have default SSH clients, but if you are using Windows, you will need to download and install an SSH client.

Use LAN to Connect to SSH

If you want to use the local area network (LAN) to connect to your system, use this line:

ssh account_name@

Change the “account_name” to your username and the numbers with the IP address of the system using the SSH service.

You can easily find out your IP address with the following command:

ip a

Once you enter the requested details, the system will go ahead and make the connection via SSH. It will ask you whether you want to continue connecting. Go ahead and type “y” to confirm. When the system asks for the password, enter the access code, too.

If you successfully make the connection, the system will send you a welcome message.

Use the Internet to Connect to SSH

The alternative to using LA is to use the internet. However, keep in mind that this requires knowledge of the public IP address of your system. Additionally, you should set the port 22 of your router to accept data and send it to your SSH-running Ubuntu device.

You can easily find the public IP address of the machine you want to connect to by heading to

The problem might be to set your router properly for port forwarding. Since each router is different, you should check out the official instructions or consult the manufacturer. Your goal is to set the port number for making requests to 22 and enter the private IP of the machine you want to connect to. The reason why you are using port 22 is that it is the default SSH port.

As we mentioned, you can use the following command on your SSH-running system to obtain its private IP address:

ip a

When you complete the setup process of your router, the logging in part is pretty simple. Start by entering this command:

ssh account_name@

How to Disable SSH on Ubuntu

If you estimate that there is no need to use SSH on your Linux-based system anymore, you can disable it. The command for doing so looks like this:

systemctl stop ssh

Keep in mind that this will only disable the service. If you want to run SSH again, type:

systemctl start ssh

You will need the super-user permission for both of these commands.

If you do not want SSH to start when you boot your system, use the following line:

systemctl disable ssh

If you want it to start together with your system, type the following:

systemctl enable ssh

Wrap Up

Using the SSH service is a vital security measure when using remote machines to connect to your system. The process of enabling SSH on Ubuntu is fairly simple and doesn’t take a long time.

When it comes to additional options, those that often connect to the system might consider a key-based authentication to connect via SSH. That will save you from typing the password every time you want to make the connection. You can also use the SSH configuration file to manage multiple systems, but that is also an advanced utility.

In this guide, we focused on the basics to teach you how to enable SSH on Ubuntu to make secure connections with a remote server.

Related posts

Leave a Reply

Required fields are marked *

Copyright © 2022 All rights reserved.