This article covers the procedure of allowing a UFW port on Ubuntu. In fact, UncomplicatedFirewall (UFW) is a command-line, frontend iptables manager, similar to Firewalld and ConfigServer Security & Firewall (CSF).
How to Close a Port using UFW on Ubuntu ?
After you uninstall software you should close any ports you no longer need open on your system. You can accomplish this using the service name or port number.
1. To close a port in UFW using the service name:
$ sudo ufw deny pop3
2. To close a port in UFW using the port number:
$ sudo ufw deny 995
How to Check Open Ports using UFW on Ubuntu ?
1. To check whether UFW is running:
$ sudo ufw status
2. To check whether UFW is running with additional information such as logging and profile status:
$ sudo ufw status verbose
3. To find the rule number for UFW rules:
$ sudo ufw status numbered
4. Then you can remove the rule:
$ sudo ufw delete 1