Introduction
The Unified Firewall (UFW) is a network firewall technology that allows network administrators to control the incoming and outgoing traffic on their networks. UFW can be used to protect networks from malicious attacks, prevent unauthorized access to systems, and protect data from being stolen.
In this post, You will get information about How to deny a port using ufw firewall service in ubuntu linux.
Step 1: Get UFW status
You need to 1st check your ufw service is status by using given command.
sudo systemctl status ufw.service
Step 2: Start UFW Firewall
You need to execute the following command in order to deny port number in ufw firewall service.
sudo ufw deny <PORT-NUMBER-HERE>
For example with port 80
sudo ufw deny 80
Step 3: Validate the Rule
You need to execute the given command to check the rule applied or not.
sudo ufw status
Conclusion
We have successfully deny port in UFW firewall, Kindly report in case you are facing difficulties with following details.
- OS name
- OS version
- Package name
- Logs – Error / Warning / failed