Back to Linux guides

TUFW Explained: A Simple UI for UFW

Stanley Ulili
Updated on November 27, 2025

In server administration, security is fundamental. A server without a properly configured firewall is vulnerable to unauthorized access, with malicious actors constantly scanning for exposed systems. While Linux provides powerful command-line tools like iptables and its more user-friendly front-end ufw (Uncomplicated Firewall), mastering their syntax can be challenging, especially if you don't configure firewalls daily.

This is where tufw comes in. TUFW (Terminal UI for UFW) provides a simple, intuitive terminal-based interface for managing your Uncomplicated Firewall. It transforms command-line firewall management into a visual, form-based experience, making it easier to add, edit, and remove firewall rules. You can block or allow specific ports, restrict access to certain IP addresses, and manage network traffic without memorizing commands and flags.

This guide explores tufw in depth, covering everything from the basics of ufw and installing tufw to creating practical security rules for common applications like SSH and web servers. You'll also learn about advanced features like IP-specific restrictions and understand the tool's strengths and limitations.

Understanding ufw

Before appreciating tufw's simplicity, it's important to understand the tool it's built upon: ufw.

From iptables to ufw

At the core of Linux networking security is Netfilter, managed through iptables. While iptables is incredibly powerful and flexible, allowing granular control over network packets, its power comes at the cost of complexity. The syntax is notoriously difficult and verbose, making it daunting even for experienced administrators.

Recognizing this complexity, Ubuntu's creators developed ufw, the Uncomplicated Firewall. As its name suggests, ufw provides a simpler, more intuitive front-end for managing iptables. It abstracts away complex syntax and provides a straightforward command structure for common firewall tasks. For example, allowing SSH traffic on port 22 is as simple as:

 
sudo ufw allow 22

This is a vast improvement over the equivalent iptables command. ufw is pre-installed on Ubuntu and many other Debian-based distributions, making it the de-facto standard for basic firewall management on these systems.

A screenshot of the official Ubuntu Server documentation for `ufw`, highlighting its name: "ufw - Uncomplicated Firewall".

Why a UI for ufw

While ufw is more user-friendly than iptables, it's still a command-line tool. If you don't configure firewalls regularly, it's easy to forget specific syntax for complex rules. For instance, allowing traffic on a specific port for only TCP protocol from a particular IP address requires:

 
sudo ufw allow proto tcp from 192.168.1.100 to any port 8080

Remembering the correct order of proto, from, to, and port can be cumbersome. This is precisely the problem tufw solves. It provides a Terminal User Interface (TUI) that presents these options as fields in a form. You navigate through fields and fill in necessary information. This visual approach eliminates the need to memorize syntax, reduces the chance of typos, and makes firewall management faster and more intuitive. tufw doesn't replace ufw, it acts as a powerful manager for it. Every rule you create in tufw is translated into a standard ufw rule behind the scenes.

Installing tufw

Setting up tufw on your Linux server is straightforward. The tool is distributed as a binary package that you can download directly from its official GitHub repository. You should always check the TUFW GitHub Releases Page to find the correct package for your server's specific architecture (e.g., linux_amd64.deb for standard 64-bit systems, or linux_arm64.deb for ARM64 systems).

Download the appropriate .deb package from GitHub using curl. The -L flag tells curl to follow any redirects, and the -o flag specifies the output filename:

 
curl -L https://github.com/peltorator/tufw/releases/download/v0.2.7/tufw_0.2.7_linux_arm64.deb -o tufw.deb

A terminal displaying the `curl` and `sudo dpkg` commands used to install `tufw`.

Once the download completes, install the package using dpkg (Debian Package Manager). The -i flag stands for "install":

 
sudo dpkg -i tufw.deb

After installation, launch the application with sudo, as firewall modifications require root permissions:

 
sudo tufw

The tufw interface is elegantly simple, divided into two main panels that provide a clear workspace for managing firewall rules.

The main `tufw` interface, showing the Menu panel on the left and the Status/Form panel on the right.

The menu panel

The left panel is your main menu, containing all the actions you can perform. You can navigate using arrow keys and select options by pressing Enter. The key in parentheses next to each option is a hotkey for direct access.

The menu options include:

  • (/) Search a rule: Filters the list of rules based on a search query
  • (a) Add a rule: Opens the rule creation form in the right panel
  • (e) Edit a rule: Allows you to modify a selected existing rule
  • (d) Delete a rule: Deletes the currently highlighted rule
  • (s) Disable ufw: Turns off the firewall entirely
  • (r) Reset rules: Deletes all existing rules, returning the firewall to a default state
  • (q) Exit: Closes the tufw application

The status and form panel

The right panel serves a dual purpose. By default, it displays the status of your current firewall rules in a clean, tabular format. The columns show the rule number (#), the destination (To), the Port, the Action, the source (From), and any Comment you've added.

When you choose an action like "Add a rule" or "Edit a rule," this panel transforms into an interactive form. You can navigate between form fields using Tab or arrow keys. Dropdown menus, like the one for "Action," can be opened with Enter or spacebar and navigated with arrow keys.

Creating firewall rules with tufw

tufw makes it easy to create and manage firewall rules through its intuitive interface. Here are some common scenarios.

Allowing SSH access

When you first enable a firewall, its default policy is often to deny all incoming traffic. If you enable it without first creating a rule to allow SSH (port 22), you'll immediately lock yourself out of your server.

To create an SSH rule, select (a) Add a rule from the menu. The rule creation form appears in the right panel. Enter 22 in the Port field for SSH. The default Action is ALLOW IN, which permits incoming connections. For a basic SSH rule allowing access from any IP address, you can leave the To, Interface, Protocol, From, and Comment fields blank. tufw applies sensible defaults. Navigate to the Save button using Tab and press Enter.

Two new rules appear in the Status panel: one for Anywhere to port 22 (IPv4) and another for Anywhere (v6) to port 22 (IPv6). tufw automatically creates rules for both internet protocols, ensuring your server is accessible over both IPv4 and IPv6 networks.

Opening ports for web applications

For a web application running on your server, such as a Node.js server listening on port 3000, the firewall will block all access to this port by default. To allow access, select "Add a rule" again from the menu. Enter 3000 in the Port field.

Web traffic (HTTP) runs over the TCP protocol. While leaving the protocol blank often works, it's good practice to be specific. Navigate to the Protocol field, open the dropdown, select tcp, and confirm.

Adding comments to your rules helps remember their purpose later. Navigate to the Comment field and type something descriptive, like bun server or webapp. Save the rule, and your web application on port 3000 becomes accessible to the outside world.

IP whitelisting for enhanced security

One of the most powerful firewall features is restricting access to specific IP addresses. This is extremely useful for services that shouldn't be publicly exposed, such as administrative panels, databases, or even SSH itself if you only connect from a fixed location.

To restrict port 3000 to only allow connections from your home or office IP address, first find your public IP address by searching "what is my IP" in Google or running curl ifconfig.me in your local terminal. If your IP is 80.44.145.171, you can modify the existing rule.

In tufw, highlight one of the rules for port 3000 using arrow keys, then select (e) Edit a rule from the menu. The edit form appears, pre-filled with the rule's current settings. Navigate to the From field, which specifies the source IP address. Enter your IP address: 80.44.145.171.

The `tufw` form with a specific IP address entered into the "From" field, restricting access.

Save the changes. Repeat this process for the second port 3000 rule if you want to apply the same restriction for both IPv4 and IPv6. Now, only traffic originating from the IP address 80.44.145.171 can reach port 3000 on your server. Any other connection attempt will be dropped by the firewall.

Understanding rule actions

tufw gives you full control over how the firewall handles traffic through the Action field. Here are the most common options:

The dropdown menu for the "Action" field is shown, listing options like ALLOW IN, DENY IN, REJECT IN, and LIMIT IN.

ALLOW IN/OUT is the most common action. ALLOW IN permits incoming connections, and ALLOW OUT permits outgoing connections.

DENY IN/OUT instructs the firewall to silently drop the packet. The sender receives no response and will typically have to wait for the connection to time out. This is often preferred as it doesn't give an attacker information about the firewall's presence.

REJECT IN/OUT also blocks the packet but, unlike DENY, sends a "connection refused" error message back to the sender. This can be useful for debugging but provides more information to a potential attacker.

LIMIT IN/OUT is a special action that helps prevent brute-force attacks. It allows a connection if the same IP address has not attempted to initiate 6 or more connections within the last 30 seconds. It's an excellent choice for public-facing services like SSH.

Managing and deleting rules

As your server's needs change, you'll need to manage your firewall rules. To delete a rule, use arrow keys in the Status panel to highlight the rule you want to remove, then select (d) Delete a rule from the menu (or press the 'd' hotkey). A confirmation dialog appears. Select Confirm and press Enter, and the rule will be instantly removed.

To reset all rules and start from scratch, select (r) Reset rules. This wipes out all existing rules and disables the firewall, allowing you to reconfigure it completely. Use this with caution.

Verifying your firewall configuration

Since tufw is a front-end for ufw, you can use standard ufw commands to verify the rules. Exit tufw by pressing 'q'. In your server's terminal, run:

 
sudo ufw status verbose

This command displays a detailed list of all active firewall rules, the default policies (e.g., deny incoming, allow outgoing), and the overall status. You'll see that the rules you created visually in tufw are listed here in the standard ufw format, confirming everything is working as expected.

The output of the `sudo ufw status verbose` command, showing the rules that were created in `tufw` in the standard command-line format.

Strengths and limitations of tufw

tufw is an outstanding utility, but it's important to be aware of its limitations along with its strengths.

The strengths

Ease of use is tufw's biggest advantage. It lowers the barrier to entry for proper firewall management, making server security accessible to everyone. For both beginners and experts, the visual interface is often faster than typing out long commands, especially for complex rules.

By using a form-based approach, tufw significantly reduces the risk of syntax errors and typos that can easily occur when using the command line. If you only manage servers occasionally, tufw is particularly valuable, as you don't need to re-learn ufw syntax every time.

The weaknesses

Navigation is primarily through arrow keys and Tab. For heavy terminal users, particularly those accustomed to Vim-style keybindings (H, J, K, L), this can feel a bit restrictive.

If you enter an invalid value into a field (e.g., an incorrectly formatted IP address or a non-existent application name), the interface does not provide immediate visual feedback or an error message. The rule simply fails to save.

To see why a rule failed to save, you need to run tufw with a logging flag to output errors to a file, and then view that file. This is less convenient than immediate feedback. The command for this is:

 
sudo /usr/local/bin/tufw -log /tmp/tufw_debug.log

You would then inspect the log file with:

 
cat /tmp/tufw_debug.log

The tool can sometimes exhibit small quirks, such as showing duplicate input fields when editing a rule or incorrectly reporting the firewall as disabled if there are no rules present. These are minor annoyances but worth noting.

Final thoughts

Securing a Linux server is a non-negotiable task for any administrator, and a well-configured firewall is the cornerstone of that security. While the native ufw command-line tool is a massive improvement over iptables, it can still present a learning curve. tufw brilliantly bridges this gap by providing a polished, intuitive, and highly effective Terminal User Interface. It democratizes firewall management, empowering users of all skill levels to implement robust security policies with confidence and ease.

This guide covered the entire lifecycle of using tufw, from understanding its purpose and installing it to creating, managing, and verifying firewall rules for practical, real-world applications. You've seen how to secure SSH, open ports for web servers, and implement advanced IP-based restrictions. Despite a few minor shortcomings, tufw is an exceptional tool and a valuable addition to any sysadmin's toolkit. It proves that powerful security management doesn't have to be complicated.

Got an article suggestion? Let us know
Next article
Ansible
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.