Linux - How to deny allow certain ip address, Secure SSH by blocking IP Address

How to deny allow certain ip address

Harden Server

In the last article we have seen how to secure shell by alerting through mail. You can also harden the server by blocking the certain server IP Address or by block all the IP Address except a certain IP Address so that you can login into you shell only by your IP Address. But make sure that you are the owner of your password and don't let anyone to know about your password. There are several ways to harden your server but the first thing is that you have to block or protect your shell from the intruders.

Steps to deny or allow certain IP's
In linux you can use /etc/host.allow file to allow the IP Address and /etc/host.deny to block the IP Address. These steps are not much harder. These are the simple steps to block or allow the IP Address. Those who are not good with IP Address can use these files to block or allow IP Address. But be sure that don't block your IP Address.


To deny all IP's logging into SSH
 # vi /etc/hosts.deny 
   ALL: ALL [It means that all the IP's are blocked now]

   ALL: IPaddress [Block all the services for certain IP Address]

Open the file /etc/host.deny file and block all the service for a specific IP Address. you can also deny certain services for a particular IP address.


To allow only certain IP's for logging into SSH
  # vi /etc/hosts.allow

    ALL : 127.0.0.1

    sshd : IPaddress : allow [only ssh service]

    ALL : IPaddress : allow [all services]


This is a method to Secure SSH by blocking IP Address. Now you configured your server to deny or allow certain IP Address.

The topic on Linux - How to deny allow certain ip address is posted by - Math

Hope you have enjoyed, Linux - How to deny allow certain ip addressThanks for your time

Tech Bluff