Oct 3, 2023 3 min read

How to Disable Firewall on Ubuntu 18.04

Disable Firewall on Ubuntu 18.04 with our step-by-step tutorial. A firewall configuration tool named UFW is included with Ubuntu.

Disable Firewall on Ubuntu 18.04
Table of Contents

Introduction

Before we begin talking about how to disable firewall on Ubuntu 18.04, let's briefly understand – What is Firewall?

A firewall configuration tool named UFW (Uncomplicated Firewall) is included with Ubuntu. The major objective of UFW, a user-friendly front-end for manasging iptables firewall rules, is to make managing firewall rules simpler or uncomplicated, as the name suggests.

It is very advised to keep the firewall enabled. Yet, there are times when you might need to stop or disable the firewall, such as during testing.

In this tutorial, you will disable firewall on Ubuntu 18.04. We will also address a few FAQs on how to disable firewall on Ubuntu 18.04.

Prerequisites

Ensure that you are logged in as a user who has sudo privileges.

Checking the Firewall Status

Use the ufw status command to check the UFW firewall's current status:

sudo ufw status

By default, the UFW firewall is disabled. If UFW has never been activated previously, the output will appear as follows:

Output

Status: inactive

Disabling the Firewall

Use the ufw disable command on your Ubuntu system to disable the UFW firewall:

sudo ufw disable

The output will appear as follows:

Output

Firewall stopped and disabled on system startup

The aforementioned command will stop and disable the firewall, however, it will not remove the firewall rules. The same rules will be loaded the next time you enable the firewall.

Use the ufw reset command to disable the firewall and remove all firewall rules:

sudo ufw reset

You will be asked if you wish to proceed with the operation:

Output

Resetting all rules to installed defaults. This may disrupt existing ssh
connections. Proceed with operation (y|n)? 

Output

Backing up 'user.rules' to '/etc/ufw/user.rules.20190122_115214'
Backing up 'before.rules' to '/etc/ufw/before.rules.20190122_115214'
Backing up 'after.rules' to '/etc/ufw/after.rules.20190122_115214'
Backing up 'user6.rules' to '/etc/ufw/user6.rules.20190122_115214'
Backing up 'before6.rules' to '/etc/ufw/before6.rules.20190122_115214'
Backing up 'after6.rules' to '/etc/ufw/after6.rules.20190122_115214'

When you wish to undo all of your changes and start over, resetting UFW firewall can be useful.

Enabling the Firewall

Make that the SSH port is open for connections before enabling the firewall.

Run the following command to enable the firewall:

sudo ufw enable

When prompted, enter y to continue the operation:

Output

Command may disrupt existing ssh connections. Proceed with operation (y|n)?

Output

Firewall is active and enabled on system startup

FAQs to Disable Firewall on Ubuntu 18.04

How can I check the status of the firewall on Ubuntu 18.04? 

You can use the command sudo ufw status to check the status of the Uncomplicated Firewall (UFW) on Ubuntu.

What is the command to disable the firewall on Ubuntu 18.04? 

To disable the firewall, you can run the command sudo ufw disable. This will turn off the firewall immediately.

How do I manually stop the firewall service on Ubuntu 18.04? 

You can stop the firewall service by running sudo systemctl stop ufw.service. This will halt the firewall service until it is started again or the system is rebooted.

How can I make sure the firewall stays disabled even after a system reboot? 

You can disable the firewall service permanently by running sudo systemctl disable ufw.service. This prevents the firewall from starting automatically on boot.

Can I configure exceptions or rules within the firewall instead of disabling it entirely? 

Yes, UFW allows you to configure specific rules to allow or deny traffic. You can use commands like sudo ufw allow or sudo ufw deny to define rule exceptions.

Are there any risks associated with disabling the firewall on Ubuntu 18.04? 

Yes, disabling the firewall removes a layer of protection for your system, potentially exposing it to network-based threats. Only disable the firewall if necessary, and enable it again when no longer required.

How do I enable the firewall again if I have disabled it on Ubuntu 18.04? 

You can enable the firewall by executing sudo ufw enable. This will activate the firewall with the previously configured rules.

Conclusion

You have learned how to stop and permanently disable the firewall on an Ubuntu 18.04 system in this article.

The majority of UFW commands are intuitive and simple to remember. For instance, ufw disable disables the firewall while ufw status displays the status of the firewall.

If you have any queries, feel free to post a comment below, and we'll be happy to answer them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.