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:
Open a new Terminal Window
Enter the following command:
sudo ufw allow 22
The typical success message will look similar to the below:
Rules updated Rules updated (v6)
Replace 22 with your port number that you would like to grant access to.