UFW stands for Uncomplicated Firewall and it is an application for managing the firewall rules and IP tables efficiently. When we say that we want to limit the SSH access with UFW then we mean that generally the firewall will allow the SSH connections from all the IP addresses but if an IP address will attempt to make six or more connections within 30 seconds, then the access will be denied to it. This is done to prevent Denial of Service (DoS) or Distributed Denial of Service (DDoS) attacks on a server.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related SSH firewall system queries.
In this context, we shall look into the procedure of limiting the SSH access with UFW on a Linux Mint 20 system.
How Can We Limit the SSH Access with UFW on Linux Mint 20 ?
If you wish to limit the SSH access with UFW on a Linux Mint 20 system, then you will have to perform the following steps.
1. Check if SSH is enabled on your System
To begin, you need to verify if SSH is enabled on your system or not. For that, you will have to check its status with the below command:
$ sudo systemctl status ssh
If everything is alright, you will see that SSH is enabled on our system and is actively running.
2. Install UFW on your System
After ensuring that, you need to install UFW on your system if it is not already installed on it with the below command:
$ sudo apt install ufw
3. Check the Status of UFW on your System
After installing UFW on your system successfully, you can check its status with the help of the below command:
$ sudo ufw status
If ufw was already installed on your system, then some rules will be already defined in it.
4. Limit the SSH Access with UFW on your System
Now, we are supposed to add a new rule for limiting the SSH access on our system by means of the below command:
$ sudo ufw limit ssh
Upon the successful execution of this command, your UFW rules will instantly be updated.
5. Verify if the SSH Access has been Limited on your System or not
After limiting the ssh access successfully, you can verify if the SSH access has been limited or not by checking its status once again with the "sudo ufw status" command. This time, you will be able to see in the output that a new UFW rule has been added that will limit the SSH access.
[Need help configuring SSH firewall on your system ? We can help you. ]