LAN: Entering Passive Mode returns wrong IP, causing ECONNREFUSED

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » Ftp » pure-ftpd

LAN: Entering Passive Mode returns wrong IP, causing ECONNREFUSEDLast Modified: Dec 1, 2016, 3:24 pm
If you're on a LAN, and trying to connect to FTP from a remote location, after you've connected to port 21, if you transfer any data, it will usually be done in Passive Mode, where the client connects to the server a 2nd time on a high random port number (35000-35999).

However, if you're on a LAN, when the request for data transfer happens, the ftp server will responsd with with which IP to connect to, which might look like:

Command:        PASV
Response:       227 Entering Passive Mode (192,168,1,2,139,237)
Command:        MLSD
Error:          The data connection could not be established: ECONNREFUSED - Connection refused by server

where is the LAN IP, and not accessible from a remote location.

We need it to show your public/external IP, so if you're running pure-ftpd:
  1. first select which type you have, init.d or systemd (newer OSs use systemd):
  2. and edit the following file:


  3. and after the listed OPTIONS lines, add a new options line:

    OPTIONS="${OPTIONS} --forcepassiveip"

    where you'd replace with your public server IP.
  4. and then restart pure-ftpd:

    /etc/init.d/pure-ftpd restart

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST