[Resolved] Allow only selected IP addresses access to FTP

shufil

Well-Known Member
Mar 19, 2014
71
0
6
cPanel Access Level
Root Administrator
Hello,

In our server getting lot of attack to using 21 port , so i need to change ftp port number and connection only allowed selective ip address , how can i do this ?

Regards,
Shufil
 

JaredR.

Well-Known Member
Feb 25, 2010
1,834
27
143
Houston, TX
cPanel Access Level
Root Administrator
Re: Ftp connect only selected ip es

Please do not post support questions in General Lounge. General Lounge is meant for off-topic conversations that are not about cPanel. This question is related to something that is part of cPanel, so I moved it to a more appropriate section.

You can restrict access to FTP in the WebHost Manager, in Home » Security Center » Host Access Control. This is documented here:

http://documentation.cpanel.net/display/ALD/Host+Access+Control

Note that you must use ProFTPd for this. Pure-FTPd will not respect the rules you set in Host Access Control. You can switch from Pure-FTPd to ProFTPD in Home » Service Configuration » FTP Server Selection.

Port 21 is the standard FTP port, and FTP clients expect to use it. Because of that, changing the FTP port is generally a bad idea. You can effectively restrict access using Host Access Control. Note that Host Access Control will not prevent an unwanted visitor from making a connection, but it will prevent it from logging in.

Another option is to configure the iptables firewall on your server to block the unwanted IP addresses. cPanel does not provide a firewall configuration tool, so you may want to install a third-party tool like CSF or APF if you have not done so already. Information about those tools is available on their respective sites:

ConfigServer Security & Firewall
https://www.rfxn.com/projects/advanced-policy-firewall/
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
87
78
cPanel Access Level
DataCenter Provider
You could do this easily with CSF, no need to change the port number

Just close port 21 in csf.conf, then whitelist any IP addresses that need FTP access.