Run FTP on multiple ports (Proftpd & Pure-FTPD)

In many cases you don't want to allow default FTP port which is 21 and need to set FTP on different port OR you want both for FTP. Here I am specifying the steps to configure FTP on multiple ports and I am using custom port number 8226 here for FTP:

Pro-FTPD

in pro-ftpd, its quite simple and you just need to specify the different port in "/etc/pure-ftpd.conf" as given below:
---------------------
Port                            8226
PassivePorts    30000 50000
---------------------

On my testing server I've added these lines above following line which works fine:
---------------------
# Umask 022 is a good standard umask to prevent new dirs and files
---------------------

Once you are done with the changes, restart the service:
---------------------
/etc/init.d/proftpd restart
---------------------

make sure it is working through following command:
---------------------
root@[~]# netstat -lpn | grep ftp
tcp        0      0 :::8226                     :::*                        LISTEN      854817/proftpd: (ac 
tcp        0      0 :::21                       :::*                        LISTEN      854817/proftpd: (ac 
---------------------

Now try connecting with both ports and it should work.

Pure-FTPD

Pure-FTPD configuration is bit lengthy but it is always recommended to use pure-ftp instead as Pure-FTPd is generally regarded as faster FTP than Pro FTPd. So here is the configuration for running pure-ftpd on multiple ports

1. Make a copy of default pure-ftpd.conf file
---------------------
cp -p /etc/pure-ftpd.conf /etc/pure-ftpd-8226.conf
---------------------

2. Edit the file /etc/pure-ftpd-8226.conf
---------------------
vi /etc/pure-ftpd-8226.conf
---------------------

3. Find and replace the lines
---------------------
# Bind 127.0.0.1,21
With
Bind 0.0.0.0,8226
---------------------

4. Now make a copy of 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-8226
---------------------

5. 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
---------------------

6. Find and replace the lines
---------------------
$DAEMONIZE $fullpath /etc/pure-ftpd.conf -O clf:/var/log/xferlog $OPTIONS –daemonize
With
$DAEMONIZE $fullpath /etc/pure-ftpd-8226.conf -O clf:/var/log/xferlog $OPTIONS –daemonize
---------------------

7. Now start the new service.
---------------------
/etc/init.d/pure-ftpd-8226 start
---------------------
Done, now make sure that both ports are working
---------------------
root@vault [~]# netstat -lpn | grep ftp
tcp        0      0 0.0.0.0:6497                0.0.0.0:*                   LISTEN      7589/pure-ftpd (SER 
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      23093/pure-ftpd (SER
---------------------
Note :: 
# If you want to stop serving port 21 for FTP with pure-ftpd, simply stop the default service:
---------------------
/etc/init.d/pure-ftpd stop
---------------------
and restart another start-up script
---------------------
/etc/init.d/pure-ftpd-8226 restart
---------------------
That's it.

# The another important thing is that you need to allow passive port range in custom conf file (/etc/pure-ftpd-8226.conf), simply remove the comment (#) in front of below line:
---------------------
PassivePorts    30000 50000
---------------------
# Make sure that passive port range (30000:50000) and custom port (8226) is open in firewall if you have any

I hope this post will make your work easier :-) 



    1 comments:

  1. I will help you ,


    Port 21211
    Umask 022
    ServerName "VirtualHost FTP"
    DefaultRoot /home/testfile
    DirFakeGroup On root
    DirFakeUser On proftpd
    DefaultRoot ~
    MaxClients 20

    TLSEngine on
    TLSRequired off
    TLSRSACertificateFile /etc/ftpd-rsa.pem
    TLSRSACertificateKeyFile /etc/ftpd-rsa-key.pem
    TLSVerifyClient off
    TLSCipherSuite HIGH:MEDIUM:+TLSv1:!SSLv2:+SSLv3