How to allow access only within country

The solution quite simple, just deny all the access and allow that country IP.

<Limit GET HEAD POST>
order deny,allow
deny from all
allow from country IP 
</LIMIT>

Or you want to deny only one or several country

<Limit GET HEAD POST>
order allow,deny
deny from country IP 
deny from country IP 
allow from all
</LIMIT>

How to check the that country IP range, you can get the detail from this Useful site

Disable all the IP form access FTP except some IP

If you want to only allow few IP to access the FTP service, and disallow all other IP. How??? You can know add all whole world IP on it, right? 🙂

Instead of add the IP that you want to deny, why you not only allow few IP. Here is the trick!!

If you cpanel do have csf firewall, then it will much easier.

(1) Disable the port 21 (assume that you are use default port 21 for FTP service)

(2) Add below link in the allow list

tcp:in:d=21:s=IP

IP= the IP that allow to access

Done!!! Well Done!! 🙂