How to Change Default FTP Port on a cPanel Server

Change default FTP port for greater security for the server and to its contents, if the server is a shared one. Not only because the default port gives you a connection automatically and if they could guess the password, your content is in risk. So, I would suggesto to change the FTP port to a non standard one.

To Change default FTP port to which the FTP service listens to, we need SSH access.

PureFTP

Login to the server as root, and navigate to /etc

cd /etc
pico pure-ftpd.conf

Search for this line

# IP address/port to listen to (default=all IP and port 21).
# Bind 127.0.0.1,21

and change to the desired value , here, I am going to change it to 21001

# IP address/port to listen to (default=all IP and port 21).
Bind 0.0.0.0,21001

If you want to allow specific IPs, you can enter them in line.

Bind 192.168.1.2,21001
Bind 192.168.1.3,21001

Now restart ftp server

/scripts/restartsrv_ftpserver

You should make sure that traffic through the new port is allowed in firewall to get this operational.

 

ProFTP

If you are using proftpd then follow the steps below to Change default FTP port:

Login to ssh via root

Edit /etc/proftpd.conf and change:

Port 21

to

Port 21001

Now restart ftp server

/scripts/restartsrv_ftpserver
Close Menu