Close a Port in UFW
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
Check Open Ports in UFW
After making changes to any firewall, you should verify your changes to ensure they’re correct and active.
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