1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Starting vsftpd from the GUI on an alternative port fails

Discussion in 'Tomato Firmware' started by menses, Nov 25, 2012.

  1. menses

    menses Addicted to LI Member

    Try to start vsftpd from the GUI by setting it to run on WAN and some other port than the default 21. Now connect to the server from the WAN. And the connection (passive) will fail (the last line):
    Code:
    Nov 26 21:09:34 tomatobox ftp.info vsftpd[2343]: [ftp] OK LOGIN: Client "65.55.57.27", anon password "42"
    Nov 26 21:09:34 tomatobox ftp.info vsftpd[2345]: [ftp] FTP response: Client "65.55.57.27", "230 Login successful."
    Nov 26 21:09:34 tomatobox ftp.info vsftpd[2345]: [ftp] FTP command: Client "65.55.57.27", "SYST"
    Nov 26 21:09:34 tomatobox ftp.info vsftpd[2345]: [ftp] FTP response: Client "65.55.57.27", "215 UNIX Type: L8"
    Nov 26 21:09:35 tomatobox ftp.info vsftpd[2345]: [ftp] FTP command: Client "65.55.57.27", "PWD"
    Nov 26 21:09:35 tomatobox ftp.info vsftpd[2345]: [ftp] FTP response: Client "65.55.57.27", "257 "/""
    Nov 26 21:09:35 tomatobox ftp.info vsftpd[2345]: [ftp] FTP command: Client "65.55.57.27", "TYPE I"
    Nov 26 21:09:35 tomatobox ftp.info vsftpd[2345]: [ftp] FTP response: Client "65.55.57.27", "200 Switching to Binary mode."
    Nov 26 21:09:36 tomatobox ftp.info vsftpd[2345]: [ftp] FTP command: Client "65.55.57.27", "CWD /"
    Nov 26 21:09:36 tomatobox ftp.info vsftpd[2345]: [ftp] FTP response: Client "65.55.57.27", "250 Directory successfully changed."
    Nov 26 21:09:36 tomatobox ftp.info vsftpd[2345]: [ftp] FTP command: Client "65.55.57.27", "PASV"
    Nov 26 21:09:36 tomatobox ftp.info vsftpd[2345]: [ftp] FTP response: Client "65.55.57.27", "227 Entering Passive Mode (6,6,6,6,172,128)."
    Nov 26 21:09:37 tomatobox ftp.info vsftpd[2345]: [ftp] FTP command: Client "65.55.57.27", "LIST"
    Nov 26 21:10:37 tomatobox ftp.info vsftpd[2345]: [ftp] FTP response: Client "65.55.57.27", "425 Failed to establish connection."

    The problem seems to be that the GUI scripts don't give the custom port to the nf_conntrack_ftp module. You can fix the problem by loading the appropriate modules manually (modprobe nf_conntrack_ftp ports=your-custom-port) and then starting vsftpd from the terminal. But this is work that the GUI is supposed to do. See here for a more detailed solution.

    I hope this gets fixed soon. I remember running into the same bug back in 2010 with a Teddy Bear mod :)
     
    koitsu likes this.
  2. menses

    menses Addicted to LI Member

    A script to fix the issue:
    Code:
    #!/bin/sh
    /usr/bin/killall vsftpd
    /sbin/rmmod nf_nat_ftp
    /sbin/rmmod nf_conntrack_ftp
    /sbin/modprobe nf_conntrack_ftp ports=`nvram get ftp_port`
    /sbin/modprobe nf_nat_ftp
    /usr/sbin/vsftpd /etc/vsftpd.conf
    Has to be run after launching vsftpd from the GUI.
     

Share This Page