How To Install sshguard on CentOS 7

In this tutorial we learn how to install sshguard on CentOS 7. sshguard is Protects hosts from brute-force attacks against SSH and other

Introduction

In this tutorial we learn how to install sshguard on CentOS 7.

What is sshguard

Sshguard protects hosts from brute-force attacks against SSH and other services. It aggregates system logs and blocks repeat offenders using one of several firewall backends. Sshguard can read log messages from standard input or monitor one or more log files. Log messages are parsed, line-by-line, for recognized patterns. If an attack, such as several login failures within a few seconds, is detected, the offending IP is blocked. Offenders are unblocked after a set interval, but can be semi-permanently banned using the blacklist option.

We can use yum or dnf to install sshguard on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install sshguard.

Install sshguard on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install sshguard using yum by running the following command:

sudo yum -y install sshguard

Install sshguard on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install sshguard using dnf by running the following command:

sudo dnf -y install sshguard

How To Uninstall sshguard on CentOS 7

To uninstall only the sshguard package we can use the following command:

sudo dnf remove sshguard

References

Summary

In this tutorial we learn how to install sshguard on CentOS 7 using yum and dnf.