How To Install denyhosts on Ubuntu 18.04

In this tutorial we learn how to install denyhosts on Ubuntu 18.04. denyhosts is Utility to help sys admins thwart SSH crackers

Introduction

In this tutorial we learn how to install denyhosts on Ubuntu 18.04.

What is denyhosts

denyhosts is:

DenyHosts is a program that automatically blocks SSH brute-force attacks by adding entries to /etc/hosts.deny. It will also inform Linux administrators about offending hosts, attacked users and suspicious logins.

Synchronization with a central server is possible too.

Differently from other software that do same work, denyhosts doesn’t need support for packet filtering or any other kind of firewall in your kernel.

DenyHosts unfortunately does not support IPv6.

There are three methods to install denyhosts on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install denyhosts Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install denyhosts using apt-get by running the following command:

sudo apt-get -y install denyhosts

Install denyhosts Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install denyhosts using apt by running the following command:

sudo apt -y install denyhosts

Install denyhosts Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install denyhosts using aptitude by running the following command:

sudo aptitude -y install denyhosts

How To Uninstall denyhosts on Ubuntu 18.04

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

sudo apt-get remove denyhosts

Uninstall denyhosts And Its Dependencies

To uninstall denyhosts and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove denyhosts

Remove denyhosts Configurations and Data

To remove denyhosts configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge denyhosts

Remove denyhosts configuration, data, and all of its dependencies

We can use the following command to remove denyhosts configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge denyhosts

References

Summary

In this tutorial we learn how to install denyhosts package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.