B
benderb
Guest
First, make sure UFW (Uncomplicated Fire Wall) is installed. It should be installed by default in Ubuntu, but if it’s not, you can install the package using apt-get.
IMPORTANT:
We’re going to add a firewall rule to permit your SSH connection on port 22/tcp. That is the default SSH port. If you have changed it to something else, you must modify the rule below to reflect your required port number. Failure to do so will break your SSH connection and lock you out of the server as soon as you enable the firewall!
Confirm UFW is installed:
*Set the default access rules:**
Set the service rules (SSH / HTTPS):
Enable the firewall:
Check the Firewall status:
If you ever add or delete rules you should reload the firewall:
If you ever need to turn off the firewall:
IMPORTANT:
We’re going to add a firewall rule to permit your SSH connection on port 22/tcp. That is the default SSH port. If you have changed it to something else, you must modify the rule below to reflect your required port number. Failure to do so will break your SSH connection and lock you out of the server as soon as you enable the firewall!
Confirm UFW is installed:
Bash:
sudo apt-get install ufw
*Set the default access rules:**
Bash:
sudo ufw default deny incoming
sudo ufw default allow outgoing
Set the service rules (SSH / HTTPS):
Bash:
sudo ufw allow 22/tcp
sudo ufw allow 443/tcp
Enable the firewall:
Bash:
sudo ufw enable
Check the Firewall status:
Bash:
sudo ufw status
If you ever add or delete rules you should reload the firewall:
Bash:
sudo ufw reload
If you ever need to turn off the firewall:
Bash:
sudo ufw disable
Last edited by a moderator: