Step:1 – Deny all hosts

deny all incoming SSH connections

  1. Open file /etc/hosts.deny by using a text editor:
  2.  vi /etc/hosts.deny
  3. Add the following line to deny all incoming SSH connections to the server:
  4.  sshd: ALL
  5. Save and close the file.

Step:2 – Allow IP Address

  1. Open the file /etc/hosts.allow file by using a text editor
  2. vi /etc/hosts.allow
  3. Add an sshd line to allow the IP address of your choice to connect by using public SSH.
  4. sshd: IP
  5. Save and close the file.

Leave a Reply