Limit FTP Access to certain IPs

For whatever reason, be it security or otherwise, if you wish to limit FTP access to a certain IP, the IP tables rule below should do the trick:

iptables -A INPUT -s ! x.x.x.x -p tcp --dport 21 -j DROP

Replace x.x.x.x with the IP Address. The rule simply means, if IP is not x.x.x.x do drop the connection to port 21

You can do the same for other ports say SSH

iptables -A INPUT -s ! x.x.x.x -p tcp --dport 22 -j DROP

For services, you can also look into using /etc/host.allow, For instance to deny access to WHM.

whostmgrd: : allow

whostmgrd: ALL : deny




Contact Us