How to disable ssh access to specific Ip address

Post Reply
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

How to disable ssh access to specific Ip address

Post 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
Arun
WebhostingDevelopment.com
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

Re: How to disable ssh access to specific Ip address

Post by a24uall »

Another option is to
vi /etc/hosts.deny
sshd: ALL
vi /etc/hosts.allow
sshd: YOUR_IP_ADDRESS
Arun
WebhostingDevelopment.com
Post Reply

Return to “SSH”