Install, configure & enable the firewall on Ubuntu

In this article, we will discuss about  “Install, configure & enable firewall on Ubuntu”. Remote Desktop Protocol is a proprietary protocol developed by Microsoft which provides a user with a graphical interface to connect to another computer over a network connection. The user employs RDP client software for this purpose, while the other computer must run RDP server software.

What is Ubuntu? The operating system in a short check

Ubuntu is an operating system like Windows or Mac OS X. The difference: Ubuntu is available to everyone free of charge.

Various developers have further developed the Linux operating system and this is how Ubuntu came about. Other free operating systems such as Debian, Edubuntu, or Knoppix are also based on the actual Linux operating system.

Since every user can install Ubuntu on the PC for free, the operating system is usually only used on cheaper computers on which Windows is not preinstalled. Even if you don’t like Windows, you can quickly use Ubuntu.

Warning: Your system is not secure by default! To protect the server, install and configure a firewall immediately after deploying the server. This guide explains the installation and configuration of the firewall solution ufw.

To install and activate the firewall for your Ubuntu 18.04 virtual server, proceed as follows

Log in to your server via SSH.

First deactivate the firewall (usually it is already inactive).

sudo ufw disable

As a first step we set everything to “deny”. Thus, all ports are closed to the outside.

sudo ufw default deny incoming

So that you can continue to manage your system, at least open the port for the SSH protocol.

sudo ufw allow OpenSSH

Alternatively, you can only enable access via SSH for certain IP addresses. If your IP address is, enter it as follows.

sudo ufw allow from to any port 22 proto tcp

Then activate the firewall (confirm the question with “y”.

sudo ufw enable

Then check paste the command below.

sudo ufw status verbose