Pureftp On Multiple Ports

Similar to mail server on some occasions there may arise a necessity to run ftp server (running pureftp) to run on multiple ports. Say for example if you want to run your ftp server on both the standard and customized ports (ie…port 21 and 31) you can follow the instructions below to make it work. It also works well on servers running cpanel / plesk / directadmin .

 

Multiple Ports on Pure-ftpd

 

By default when you start pure-ftp, it will be listening on default port 21 on all IPs. If you want to run run pure-ftp on port 31 on IP 192.168.0.1(for example).

 

SSH your server as root :

 

  • # cp -p /etc/pure-ftpd.conf /etc/pure-ftpd-31.conf
    # vi /etc/pure-ftpd-31.conf

 

Find and replace the lines

 

  • # Bind 127.0.0.1,21
    With
    Bind 192.68.0.1,31

 

Now we need to copy the start-up script and run with the new config as a separate service.

 

  • # cp -p /etc/rc.d/init.d/pure-ftpd /etc/rc.d/init.d/pure-ftpd-31

 

Edit the /etc/rc.d/init.d/pure-ftpd-31 to load with the new config.

 

  • # vi /etc/rc.d/init.d/pure-ftpd-31

 

Find and replace the lines

 

  • $DAEMONIZE $fullpath /etc/pure-ftpd.conf -O clf:/var/log/xferlog $OPTIONS –daemonize
  • With
  • $DAEMONIZE $fullpath /etc/pure-ftpd-31.conf -O clf:/var/log/xferlog $OPTIONS –daemonize

 

Now start the new service.

 

  • # /etc/init.d/pure-ftpd-31 start

 

Make sure it starts listening on the new port

 

  • # lsof -i tcp:31
  • or
    # netsat -lpn | grep 31
    or
    # fuser -n tcp 31

 

Note : After doing the changes make sure you have added the new ports in the firewall to allow traffic on the new port.