Categories: FirewallUbuntuufw

How To Disable/Enable Firewall On Ubuntu 18.04

This comprehensive Linux guide expects that you run the following commands as root user but if you decide to run the commands as a different user then ensure that the user has sudo access and that you precede each of the privileged commands with sudo

A firewall is a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules. A firewall typically establishes a barrier between a trusted internal network and untrusted external network, such as the Internet.

The firewall is suggested to be kept enabled on your system, but in some cases, you might need to disable it. This tutorial will guide you how to disable/enable your firewall on your Ubuntu 18.04.

Checking Your Firewall Status

To check whether your firewall is enabled or disabled, you can run the following command:

root@codesposts:~$ ufw status

Status: active

This shows that the firewall is enabled.

If you want more verbose output of the status of the firewall, you can use the command like below:

root@codesposts:~$ ufw status verbose

Disabling The Firewall

You can disable the firewall by running the following command

root@codesposts:~$ ufw disable

Firewall stopped and disabled on system startup

Resetting Firewall Rules

If you disable the firewall using the above command, the firewall will be disabled but the rules will not be deleted. If you want to delete those firewall rules too, you can reset the firewall by running the following command

root@codesposts:~$ ufw reset

Resetting all rules to installed defaults. This may disrupt existing ssh
connections. Proceed with operation (y|n)? y
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'

Enabling The Firewall

If your firewall is disabled, you can run the following command to enable it:

root@codesposts:~$ ufw enable

Command may disrupt existing ssh connections. Proceed with operation (y|n)?y
Firewall is active and enabled on system startup

The post How To Disable/Enable Firewall On Ubuntu 18.04 appeared first on CODESPOSTS.COM.

Go to Source
Author: staff

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

5 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago