linux open firewall ports Ubuntu

How to open firewall ports in Ubuntu

These notes are a personal reference on how to check open firewall ports in Ubuntu using CLI. I reserve the right to be slightly inaccurate and will update this as it become functionally helpful to do so.

 

Use the ufw command to open firewall ports in Ubuntu. The syntax is as follows:

sudo ufw allow port

See the examples below and apply specific ports for the services you need to open. Remember, you don’t want to open anything that isn’t absolutely necessary. I treat all networks as “zero trust” networks and every zone as a DMZ.

How do I open tcp port # 22?

To allow incoming tcp packets on port 22, enter:
sudo ufw allow 22/tcp

Verify it:
sudo ufw status verbose

How do I open tcp port # 80 and 443?

The service specific syntax is as follows to open http and https service ports:
sudo ufw allow http
sudo ufw allow https

OR
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

 

I use these rules to configure servers for services like Jamf-Pro, which recommends that certain ports are open for the services that it uses. Refer to your vendor or developer documentation to find out more about the services you need on your own server.

About Linux CLI

A command line interface (CLI) is a type of human-computer interface (i.e., a way for humans to interact with computers) that relies solely on textual input and output. That is, the entire display screen, or the currently active portion of it, shows only characters (and no images), and input is usually performed entirely with a keyboard.

The CLI gets its name from the fact that it is an interface which contains command lines. A command line is a space on the display screen in which commands (i.e., instructions telling a computer to do something) are typed in by the user. Pressing the ENTER key after typing in a command causes that command to be passed to the shell. A shell, also referred to as a command interpreter, is a program that provides the CLI as well as reads commands that are typed on a keyboard and then executes (i.e., runs) them. The results of executing many, but not all, commands are also shown on the command line.

CLIs stand in sharp contrast to graphical user interfaces (GUIs), the other main type of human-computer interface. GUIs feature the use of graphic images, including windows, icons and menus. These objects are manipulated by a mouse (and can usually be manipulated to a limited extent by a keyboard as well).

From: http://www.linfo.org/command_line_interface.html

Other Ubuntu CLI Articles

How to check Linux OS and version using CLI

About Admin

IT Director in Austin TX • Husband & Father • Apple and Linux aficionado • Passionate about connecting w/ & supporting educators to improve teaching and learning.

Similar Posts

Leave a Reply

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