Linux disable firewall command

Let us see how to stop and disable Firewalld on a CentOS or RHEL 7.x based system.


Is firewalld running on my system?


sudo firewall-cmd --state


Stop the the firewalld

Again, type:

sudo systemctl stop firewalld


Disable the FirewallD service at boot time

sudo systemctl disable firewalld
sudo systemctl mask --now firewalld


Verify that the FirewallD is gone

Simply type:

sudo systemctl status firewalld


How do enable the firewalld again?

Simply run the following commands:

sudo systemctl unmask --now firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld
## verify that the firewalld started ##
sudo firewall-cmd --state


Linux disable ufw based firewall

ufw is easy to use app for managing a Linux firewall and aims to provide an easy to use interface for the user. It is the default on Ubuntu and can be installed on Debian, CentOS, and other Linux distros.


Is the ufw running?

The syntax is:

sudo ufw status


Stop the ufw on Linux

sudo ufw disable


Disable the ufw on Linux at boot time

sudo systemctl disable ufw


Verify that the ufw is gone

sudo ufw status
sudo systemctl status ufw


How do enable the ufw again?

Just issue the following two commands to enable the firewall and protect your box again:

sudo systemctl enable ufw
sudo ufw enable
## verify that ufw started ##
sudo ufw status


A note about older Linux distro

You need to use the service command and you must be a root user to run the following commands:


Stop the iptables service on Linux

service iptables stop


Disable the iptables service at boot time on Linux

# chkconfig iptables off
  • Iptables, Security, Networking, Linux
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

System Requirements

Most current web servers with PHP & MySQL installed will be capable of running WHMCS. The...

Common logs file paths

Log files are helpful in troubleshooting issues and in monitoring the performance of cPanel...

Disable ModSecurity in cPanel

What is ModSecurity?Mod_security is an apache module that helps to protect your website from...

How to disable directory listing in cpanel?

Disable directory listing in cpanelIndex Manger in cPanelThe Index Manager allows you to...

How to disable the listing in a non-cPanel CentOS server?

How to disable the listing in a non-cPanel CentOS server?1. Locate your httpd.conf file. Normally...