Restrict SSH login to a specific IP or host

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.

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Reply

Scroll to Top