UFW Firewall: How to open a port

Written by Ian Carnaghan · 20 sec read >

When you would like to grant SSH access on a Ubuntu machine, you would need to allow access to port 22. In order to allow access to port 22 you would need to add a rule to ufw to open up access to port 22.

To allow access to port 22 you would need to do the following:

  1. Open a new Terminal Window
  2. Enter the following command:
    sudo ufw allow 22
  3. The typical success message will look similar to the below:
    Rules updated
    Rules updated (v6)


  4. Replace 22 with your port number that you would like to grant access to.

Last Updated On April 07, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. Profile

Leave a Reply

Notify of