ufw Firewall Tutorial#
Uninstall the package using apt-get --purge remove
package name
Ubuntu Firewall#
You can enable UFW on Linux by following these steps:
- First, check if UFW is installed. Enter the following command in the terminal:
sudo ufw status
If it prompts "command not found," it means UFW is not installed on this system. You need to execute the following command to install UFW:
sudo apt-get install ufw
- To activate UFW, set the default UFW policies to deny:
sudo ufw default deny incoming
sudo ufw default allow outgoing
- Open the necessary ports. For example, open SSH port 22 (modify as needed):
sudo ufw allow 22/tcp
- Finally, enable UFW and check the status:
sudo ufw enable
sudo ufw status
If you see "Status: active" in the output, it means UFW has been successfully enabled.
Resolving Port Occupancy#
- Enter the following command to view all service ports and display the PID number.
To stop this process, you can use the kill command.
To view port 8080, you can use the grep command:
To view port 8888, enter the following command in the terminal: