Installing and configuring sshGuard

1 min read

SSHGuard is an application that protects servers from malicious actors scanning vulnerable ports to detect potential attacks. It helps prevent Denial of Service and Brute Force attacks by blocking the IP addresses of attackers.

Here's how to install and configure SSHGuard on Linux:

Step 1: Install SSHGuard

To install SSHGuard, you need to execute the following command:

sudo apt-get install sshguard -y
Step 2: Configure SSHGuard

After installing SSHGuard, you need to configure it to work on your server.

  1. Open the SSHGuard configuration file:
  2. sudo nano /etc/sshguard.conf
  3. In the configuration file, you will find various parameters that you can modify to tailor the application to your requirements. Some of the most commonly used parameters are listed below:
  • BLOCK_REPORT_EMAIL: This property sets the email address to which notifications about blocked IP addresses will be sent.
  • WHITELIST: This property allows you to specify IP addresses that should not be blocked by SSHGuard.
  • BLOCK_THRESHOLD: This property sets the number of failed authentication attempts required to block an IP address.
  • SCAN_WINDOW: This property sets the scanning time during which SSHGuard monitors activity on your server.
  • Save the configuration file after making the necessary changes.
  • Step 3: Start SSHGuard

    To start SSHGuard, enter the following command:

    sudo systemctl start sshguard

    To automatically start SSHGuard on every server boot, execute this command:

    sudo systemctl enable sshguard

    You have now successfully installed and configured SSHGuard on your Linux server.

    Didn’t find the answer?Contact support — we’ll help you sort it out.
    Open a ticket →