Categories: TutorialsUbuntu

How to Fix “firewall-cmd: command not found” error in Linux

firewall-cmd is a command line interface for firewalld, a popular firewall software for Linux systems. Firewalld offers many useful features and is often employed by many Linux system administrators to manage their networks & systems. While using firewall-cmd you may get an error ‘firewall-cmd command not found’. In this article, we will learn how to fix this issue.

How to Fix “firewall-cmd: command not found” error in Linux

This error mainly occurs because firewalld tool is not installed on your system, not properly installed on your system, or is outdated. Many systems, especially cloud virtual machines, have firewalld installed but not firewall-cmd. So when you try to configure firewall using firewall-cmd, you may get this error.

Sponsored

The solution is to install firewalld on your system. It already contains firewall-cmd packaged into it. Open terminal and run the following command for this purpose. If you have already installed it, you can skip this step.

$ sudo yum install firewalld

Next, run the following commands to start and enable autostart for firewalld, at system boot.

$ sudo systemctl start firewalld
$ sudo systemctl enable firewalld
$ sudo systemctl status firewalld

Once you have installed firewalld, you can use the following commands to open ports, e.g. port 80, and reload configuration to apply changes. Please note, we are using firewall-cmd command to manage ports.

$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload

Similarly, here are the commands to block ports.

Sponsored
$ sudo firewall-cmd --zone=public --remove-port=80/tcp --permanent
$ sudo firewall-cmd --reload

In this article, we have learnt how to fix ‘firewall-cmd: command not found’.

Also read:

How to Protect Hard & Symbolic Links
How to Run Shell Script on Another Server
How to Manage Systemd Services on Remote Linux Systems
How to Synchronize Time With NTP in Linux
How to Enable Rm Confirmation in Linux

The post How to Fix “firewall-cmd: command not found” error in Linux appeared first on Fedingo.

Ubuntu Server Admin

Recent Posts

Welcome to the Ubuntu Weekly Newsletter 883

Welcome to the Ubuntu Weekly Newsletter, Issue 883 for the week of March 9 –…

3 hours ago

How to Install nvidia-smi on Ubuntu or Debian Linux

In this article, we will see how to install nvidia-smi on Ubuntu or Debian Linux.…

15 hours ago

How to Install clang tool on Ubuntu or Debian Linux

In this article, we will see how to install clang tool on Ubuntu or Debian…

2 days ago

How to resolve Ubuntu 20.04 Container Signature Errors on Raspberry Pi ARM Devices

When working with Docker containers on Raspberry Pi devices, you might encounter frustrating signature verification…

2 days ago

How to fix DNS Resolution Issues with OpenVPN on Ubuntu 18.04

You’ve recently upgraded to Ubuntu 18.04 and found that your OpenVPN connection no longer resolves…

2 days ago

How to Fix Ubuntu 18.04 System Monitor Launch Issues

Have you ever tried to open System Monitor on your Ubuntu 18.04 system only to…

3 days ago