How to enable SSH on Ubuntu | 22.04 | 22.00 – 2023

In this article, we will enable SSH on Ubuntu.  SSH stands for Secure Sell and works on TCP port 22. SSH allows you to access your Ubuntu machine remotely. However, the communication between to user and the Ubuntu machine will be very secure.

Note: You must be login using a super user account, i.e. sudo permission!

How to enable SSH on Ubuntu

So, let’s start our configuration step by step. First, we will download the OpenSSH Server. Later, we enable SSH on the Ubuntu machine. Finally, we will access the ubuntu machine from the remote machine using an ssh client. So, let’s start the configuration.


Step 1: Install the OpenSSH Server on Ubuntu Machine

To Enable SSH on Ubuntu, you need to install OpenSSH on the Ubuntu machine. So, access the Ubuntu Terminal either using the Alt+Ctrl+T keyboard shortcut or you can click on the Terminal icon.

Note: You must need Internet Connectivity to perform below tasks.

Once, you opened the Terminal, first, you need to update the git repository. You can use the below command to update the git repository.

[terminal]sudo apt-get update[/terminal]

Once, you updated your git repository, you need to install the OpenSSH Server Package. You can use the below command to install the OpenSSH-server package.

[terminal]sudo apt-get install openssh-server[/terminal]


You need to enter your superuser password & press Y when prompted.

This command will take some time to execute. It will first download all the required packages for the OpenSSH server. Later, it will automatically install the open-ssh server on your machine.

Step 2: Enable the Open SSH Service on Ubuntu Machine

Once, you Installed the OpenSSH Server package on your Ubuntu Machine, now you need to enable the SSH service on your machine. By default, the SSH service will be enabled. However, you need to check the service. You can use the below command, to check the status of the OpenSSH Server.

[terminal]service ssh status[/terminal]

The output of this command will be looks like the below image.


Note: Press “q” to exit the output.

Step 3: Getting the Network details from the Ubuntu Machine

Now, we have successfully installed the “OpenSSH Server” or you can say open ssh service on the ubuntu machine. Now, you need to know the IP address of your ubuntu machine to access the remote machine.  In case you don’t know your machine IP, you just need to enter the below command to know the IP address.



Step 4: Allowing SSH from UFW (Firewall) on Ubuntu Machine

UFW stands for Uncomplicated Firewall. This is the Host-Based Firewall which is in Ubuntu Operating System by default. However, this firewall is disabled by default in ubuntu. Although, if you enabled UFW, you need to allow ssh through UFW. you can use the below command to allow ssh through it.

[terminal]sudo ufw allow ssh[/terminal]

Step 5: Accessing Ubuntu from the Remote Machine

Now, for accessing the Ubuntu machine, you need to use SSH Client depending on your Operating System.  If you are using Windows System, you can download putty. However, you can enable SSH from the Windows Feature itself.

If you using Linux or MAC-based systems, you can directly ssh to the Ubuntu Machine. To SSH, to a host, you need to enter the IP address followed by the IP address.

Accessing the Ubuntu Machine using Putty

First, we will access the Ubuntu Machine, using the Putty (i.e. SSH Client). You need to open the putty application and enter the IP address of the Ubuntu Machine.


Once, you hit open, a popup will appear related to SSH Encryption Key. If you want to store the key, you need to click on Yes, however, if you click on No, you will need to click on No as many times as you access the Ubuntu Machine.


Finally, you have SSH to your ubuntu machine. You can do all administrative-related tasks from there.


Accessing the Ubuntu Machine using Remote Linux Machine

Now, we will access the Ubuntu machine from one of the remote Linux. Here, you do not need to install any ssh client. You can directly access ubuntu using the terminal. You can refer to the below command for SSH using a terminal.

[terminal]ssh USERNAME@UBUNTU_IP[/terminal]

Note: Replace USERNAME & UBUNTU_IP with actuall username and IP.

As you already know, my ubuntu machine username is “gns3network” & the IP  address is

So, the original command will be looks like the below command.

[terminal]ssh gns3network@[/terminal]

The output of this command will be looks like this below

[terminal]The authenticity of host ‘ (’ can’t be established.
ECDSA key fingerprint is SHA256:Y0VoJR0nxwYIMI8jpRijEWQk8SUKYzhTJLjsdvn3uwI.
Are you sure you want to continue connecting (yes/no)? [/terminal]

Since we are connecting to this machine for the first time, so we need to press “Yes”. Once, you press “Yes”, it will be permanently stored in the .ssh folder in the home location. The next output you get will be looks like the below output.

[terminal]Warning: Permanently added ‘’ (ECDSA) to the list of known hosts.
gns3network@’s password:[/terminal]

Now, you need to enter the password of the Ubuntu machine you want to access. Once, you type the password of the Ubuntu host, you will get access to your remote ubuntu machine.
[terminal]Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.15.0-45-generic x86_64)
* Management:
* Support:
339 packages can be updated.
269 updates are security updates.
Last login: Sun Apr 19 03:12:27 2020 from

That’s it! We successfully access the Ubuntu machine from a different remote machine.

Enable SSH on Ubuntu – Q&A

In this session, we will discuss your questions regarding enabling SSH on  Ubuntu. You can comment in the comment box for any of your queries.

1. How I can access a Ubuntu Machine Over the Internet?

First, you need to understand the difference between Public IP and Private IP. Once, you read this article, you will know that we must need a public IP to access the Ubuntu Machine from the Internet. If you have a public IP, either you can assign that IP to your machine directly, otherwise, you need to configure your Firewall/Router. You will need to add NAT policies. If you have a limited number of public IPs, you can also configure Port Forwarding on your Firewall. However, the configuration is different for all the firewalls.

2. It is safe to enable SSH on Ubuntu Machine

As you already know, SSH stands for Secure Shell and works on Layer 7 of the OSI Model. On the transport layer, it uses TCP port 22.

Yes, it is very much safe to enable ssh on your ubuntu machine. SSH uses encryption algorithms and generates a key while installing the SSH Server Package, i.e. OpenSSH. All the data will be encrypted using this key. However, it will be unsafe, if someone compromises your SSH Key using some kind of attack.


Related Articles


In this article, we enabled SSH on the ubuntu machine. To enable the SSH, we first, install the OpenSSH package on the ubuntu machine. Later, we make a rule on UFW to allow ssh through the firewall. Finally, we access the Ubuntu machine using Windows & another Linux machine. We also, discuss several questions related to SSH.

Did you like this article? Share this on Social Media and show us some love 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *