Default Settings

Updated on 28 Mar 2022

Setting up default settings

UFW comes with a default policy:

  • deny all incoming connections
  • allow all outgoing connections

But just in case we need to establish this policy manually, we can do so with the following command.

sudo ufw default deny incoming
sudo ufw default allow outgoing

Of course if you tried to run ufw status, you’re not going to get much information except that UFW is enabled. However, if we use the verbose keyword we get a bit more information.

sudo ufw status verbose

Testing

First of all, this is what happens when you attempt to SSH into the server when UFW is disabled. You can see that we can access the server without any issues.

Now when UFW is enabled, you’ll see that we can’t connect to the server at all.

We can also check /var/log/ufw.log file and see that we’ve been blocked.