How Do I Enable and Disable a Port in Linux?
Contents

How do I enable or disable a port in Linux?

Execute the following command, replacing the PORT placeholder with the number of the port to be opened:

  1. Debian: sudo ufw allow PORT.
  2. CentOS: sudo firewall-cmd –zone=public –permanent –add-port=PORT/tcp sudo firewall-cmd –reload.

How do I disable a specific firewall port in Linux?

Run the following command to disable the firewall based on the ECS OS:

  1. CentOS 6. service iptables stop.
  2. CentOS 7. systemctl stop firewalld.service.
  3. Ubuntu. ufw disable.
  4. Debian. /etc/init.d/iptables stop.
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest