Sunday, April 26, 2015

Allow SSH from a specific Network

Allow SSH from a specific Network

For security reason we need to specific a network to access your server. 

$vi /etc/hosts.allow
add this:
sshd : 192.168.10.0/255.255.255.0, 172.16.10.0/255.255.255.0 

In this example allow only network: 192.168.10.0/255.255.255.0, 172.16.10.0/255.255.255.0

$vi /etc/hosts.deny
add this:
sshd : ALL

Reload services
/etc/init.d/sshd reload

Done,