Wednesday, January 27, 2010

How to change the FTP port?

How to change the Ftp port to a non-standard port?

If you have say, Pure-Ftp as a Ftp server, edit the configuration file:

pico /etc/pure-ftpd.conf

Search for the line:

# Bind 127.0.0.1,21

and add the following line below it

Bind *,2121

where, 2121 is the new port you want the Ftp server to listen to.

Save the file and restart the ftp service.

service pure-ftpd restart

Use netstat to check if the new port is listening:

netstat -al | grep 2121

If your server is behind a firewall, you will have to open the new Ftp port in the allowed list. For example, if you have CSF firewall installed on your server, edit the configuration at

/etc/csf/csf.conf

and replace port 21 with 2121 in the TCP_IN. Save the file and restart the csf firewall

csf -r

No comments:

Post a Comment