How to Enable SSH in Ubuntu 22.04.3

Photo of author

By Victor Ashiedu


Did you try ssh to your Ubuntu server and receive the “ssh: connect to host port 22: Connection refused” error? This is likely because you need to enable SSH on the Ubuntu server.

The steps covered in this guide are for Ubuntu 22.04.3. If your server is a different version, I cannot guarantee that it will work.

Step 1: Install OpenSSH Server

You need a tool to process the request to ssh to your server. The OpenSSH Server allows you to ssh to your server remotely.

The first step to enabling ssh on Ubuntu is to install the OpenSSH Server.

Follow these steps to install it.

  1. Update the Ubuntu app manager by running the command below:
sudo apt-get update

You will be prompted to enter the root password.

  1. After that, install the OpenSSH Server by running the command below:
sudo apt-get install openssh-server

Step 2: Open the SSH Port (22)

Once you’ve installed the SSH server, the final step to enabling SSH on the server is to allow port 22.

Here are the steps:

  1. Check the status of the firewall on your Ubuntu server by running:
sudo ufw status

The command should display “Status: inactive.”

  1. Enable firewall on the Ubuntu Server:
sudo ufw enable

The above command should return “Firewall is active and enabled on system startup.”

  1. Enable SSH for all incoming requests on the default port (22) via this command:
sudo ufw allow ssh

With this command, you’ve completed the steps to enable SSH on Ubuntu 22.04.3!

After this, to ssh to the server, run a command like this:

sudo user@servername
Change “user” to your username and “servername” to the Ubuntu server’s hostname or IP address.


That is it! Allowing SSH in Ubuntu is as simple as a few steps. Kindly let us know your thoughts using the comment form (“Leave a Reply”) at the bottom of this page.

Alternatively, you can respond to the “Was this page helpful?” question below.

About the Author

Photo of author

Victor Ashiedu

Victor is the founder of InfoPress Media, publishers of Ilifeguides and Itechguides. With 20+ years of experience in IT infrastructure, his expertise spans Windows, Linux, and DevOps. Explore his contributions on for insightful how-to guides and product reviews.

Related Articles

Get in Touch

We're committed to writing accurate content that informs and educates. To learn more, read our Content Writing Policy, Content Review Policy, Anti-plagiarism Policy, and About Us.

However, if this content does not meet your expectations, kindly reach out to us through one of the following means:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment

Send this to a friend