For more secure server, we have to close some ports to users.
If need access to this ports, we can give permission to our IP address. Please dont forget, “iptables” can be block all IP address but when you restart the server it will be clean all of this commands.
1. Closing FTP port except xxx.xxx.xxx.xxx
iptables -t filter -I INPUT 1 -p tcp -s ! xxx.xxx.xxx.xxx –dport 21 -j REJECT –reject-with icmp-host-prohibited
2. Closing SSH port except xxx.xxx.xxx.xxx