The ftp – service is for file transfer. The default port for ftp services are 20 and 21.
Port 20: Data transfer port Port 21: Connection port
How to change ftp port – cPanel ?
We can change the default value of ftp port from its configuration file. The first and importent step is to find which ftp service is currently running on the server.
Step 1: SSH to server:
[[email protected] ]# ssh [email protected]
Step 2: Find the ftp service:
[[email protected] ]# netstat -ntlp|grep :21 tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 3582/pure-ftpd (SER tcp 0 0 :::21 :::* LISTEN 3582/pure-ftpd (SER
In this case the ftp server is pure-ftpd.
Step 3: Change the port number:
3.1 : Pure-FTP
The configuration file for Pure-FTP service is ‘/etc/pure-ftpd.conf’
Edit the conf file:
[[email protected] ]# vim /etc/pure-ftpd.conf ----- # IP address/port to listen to (default=all IP and port 21). # Bind 127.0.0.1,21 ----- :wq
Edit /etc/chkserv.d/ftpd and change the port, which is the first comma-separated entry to the right of ‘=’ on the line in the file, to match the port you put the service on. Then restart the service.
[[email protected] ]# /etc/init.d/pure-ftpd restart [[email protected] ]# /etc/init.d/cpanel restart (restarts tailwatchd/chkservd)
3.2 : ProFTP
The configuration file is ‘/etc/proftpd.conf’. Edit /etc/proftpd.conf and change the port value.
[[email protected] ]# vim /etc/proftpd.conf ------- Port 21 ------- :wq
Then restart the service:
[[email protected] ]# /etc/init.d/proftpd start [[email protected] ]# /etc/init.d/cpanel restart (restarts tailwatchd/chkservd)
Step 4: If necessary, add the new FTP port to your server’s firewall.
[[email protected] ]# iptables -A INTUP -p tcp --dport "new" -j ACCEPT [ro[email protected] ]# iptables -A OUTTUP -p tcp --dport "new" -j ACCEPT
How to reset SSH port from WHM
How to change cpanel port through command line
How to change the apache port via command line in cpanel
2 thoughts on “How to change ftp port – cpanel”
Hi, so this is done mainly for security reasons?