1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#How to block an IP using iptables? iptables -A INPUT -s xx.xx.xx.xx -j DROP #How to block an IP for a specific port: iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP #How to allow access to an IP? iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT #How to allow access to an IP to a specific port using iptables? iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j ACCEPT #See if SSHD is running and listen to port netstat -tlpn mkdir .ssh chmod 700 .ssh nano .ssh/authorized_keys chmod 600 .ssh/authorized_keys #restart ssh ubuntu /etc/init.d/ssh |