TCP Wrappers


using hosts.allow and hosts.deny to control sshd connection in ubuntu

please make sure your hosts.allow works first, or you will lost control after create hosts.deny.

adding your ip range which allow using sshd for example :

vi /etc/hosts.allow

deny all other ip using sshd :

vi /etc/hosts.deny

deny all other ip excpet ip range :

vi /etc/hosts.deny

Other useful command :

find program full path by ps -auxwe

ps -auxwe |grep "target pid or port"

find all connection to your machine currently

netstat -tunpla
netstat -tunplac <<< monitoring continuously by adding -c

reference link :