Linux Server Install: Part 12

Configure that Firewall or you might get burned, bruh.

Laxfed Paulacy

--

Previous

To check the status of the firewall on a Linux server, you can use the ufw command. ufw stands for "uncomplicated firewall" and it is a tool for managing the iptables firewall on Linux systems.

To check the status of the firewall using ufw, you can run the following command:

sudo ufw status

This command will display the current status of the firewall, including whether it is enabled or disabled and which rules are currently in place. The output will look something like this:

This output shows that the firewall is currently active and that it has rules in place to allow incoming connections on ports 22, 80, and 443. You can use this information to determine whether the firewall is configured correctly for your needs.

If you want to see more detailed information about the firewall and its rules, you can use the ufw status verbose command, which will display additional information about each rule, such as the interface and the target. For example:

This output shows the name of the service associated with each rule and the direction of the traffic that is allowed by the rule.

If the firewall is inactive, the output will look like this:

Status: inactive

Next we’ll want to deny all incoming connections and enable the firewall, use the following commands:

sudo ufw default deny incoming
sudo ufw enable

Finally, allow incoming connections on port 22 (SSH), using the following command:

sudo ufw allow ssh

This is equivalent to using the sudo ufw allow 22/tcp command, as SSH typically uses TCP port 22.

To check the current status of the firewall, use the sudo ufw status command again. The output should look like this:

This output shows that the firewall is now active and that it has a rule in place to allow incoming connections on port 22 (SSH). All other incoming connections are denied by the default rule that was set when the firewall was enabled.

Next

--

--

Laxfed Paulacy
Laxfed Paulacy

Written by Laxfed Paulacy

Delivering Fresh Recipes, Crypto News, Python Tips & Tricks, and Federal Government Shenanigans and Content.

No responses yet