Page 1 of 1

How to disable ssh access to specific Ip address

Posted: Wed Sep 19, 2012 2:13 pm
by a24uall
How to restrict ssh access to specific Ip address

USING host.allow file
vi /etc/hosts.allow
Scroll down to the bottom of the file and add
sshd : 65.25.68.86 : allow
sshd : 287.49.180.9 : allow
sshd : ALL : deny
Save and exit and ssh will be accessible only from the specified IPs.

If its setup correct and when you try to access ssh from an external Ip you will get the error below :
ssh_exchange_identification: Connection closed by remote host

Re: How to disable ssh access to specific Ip address

Posted: Wed Oct 03, 2012 7:02 pm
by a24uall
Another option is to
vi /etc/hosts.deny
sshd: ALL
vi /etc/hosts.allow
sshd: YOUR_IP_ADDRESS