How To Ubuntu Linux Firewall Open Port Command

In Ubuntu, you can use the ufw (Uncomplicated Firewall) tool to open a specific port. Here’s how:

  1. Install ufw if it’s not already installed:
    sudo apt-get update
    sudo apt-get install ufw
  2. Enable the firewall:
    sudo ufw enable
  3. Allow incoming traffic on the desired port:
    sudo ufw allow port_number

    Replace port_number with the actual port number that you want to open. For example, to open port 80 (HTTP), you would use:

    sudo ufw allow 80
  4. Verify the firewall rules:
    sudo ufw status

    This will display the current firewall rules, including the newly opened port.

Note: The steps above assume that you have root or superuser privileges. You may also need to modify the firewall rules if you’re using a cloud-based virtual machine or a hosting service that provides a firewall.

Leave a Comment