UFW (Uncomplicated Firewall) comes with Ubuntu preinstalled, but it is disabled by default:
sudo ufw enable
Then you'll have to allow specific ports for some applications.
For example, to allow the default port of Transmission Bittorrent Client:
sudo ufw allow 51413
Another way to allow ports for an application is to create an application profile and allow that profile.
For example to allow Plex Media Server:
- Edit (create) the app profile:
sudo gedit /etc/ufw/applications.d/PlexMediaServer
- Paste the following in it:
[PlexMediaServer]
title=Plex Media Server
description=This opens up PlexMediaServer for http (32400), upnp, and autodiscovery.
ports=32469/tcp|32413/udp|1900/udp|32400/tcp|32412/udp|32410/udp|32414/udp
- Allow the profile:
ufw allow PlexMediaServer
Refer to
Ubuntu Wiki and
Ubuntu Help for more information about UFW.
The solution for Plex Media Server profile was originally posted on
Plex Forum.
Some other useful commands:
List all rules (with reference number):
sudo ufw status numbered
Then the reference numbers can be used to delete a rule:
sudo ufw delete 1
The other way to delete a rule would be like this (for an allow rule):
sudo ufw delete allow 51413