Nathan
Nathan

Reputation: 3648

FTP server connection connected but not responsive

I'm setting up an FTP server using vsftpd. To test it I have made an FTP connection using ftplib:

connection = ftplib.FTP(host)
connection.login(user=username, passwd=password)

And checked that it's connected using:

connection.voidcmd("NOOP")

However, executing nearly anything doesn't seem to work. For instance:

connection.nlst()

Waits forever and then times out.

Connecting through ftp (ubunut) I see the message:

Entering Passive Mode (0,0,0,0,xxx,xxx).

Filezilla does work, how can this be?

Upvotes: 0

Views: 703

Answers (2)

Nathan
Nathan

Reputation: 3648

The problem is that the passive connection isn't working. This can be because:

  1. the passive address isn't defined in the vsftpd.conf: pasv_address=`
  2. both listen and listen_ipv6 are defined in the vsftpd.conf

Just in case, also check if the passive ports aren't opened under the firewall rules

Upvotes: 0

Steffen Ullrich
Steffen Ullrich

Reputation: 123260

Entering Passive Mode (0,0,0,0,xxx,xxx).

The server is giving the invalid destination address 0.0.0.0 as destination for the data connection. This is due to a bug or misconfiguration in the server. Trying to connect to this wrong IP address will of course fail.

Some clients like FileZilla will still work since they simply ignore the given IP and only use the port. This behavior makes sense since in the most common use of FTP (direct transfer between a single client and a single server) the destination IP address of the data connection will be the same as for the control connection, i.e. both will be the IP of the server. This is also reflected in the newer commands EPSV and EPRT which only specify the port and no longer the IP address.

Upvotes: 2

Related Questions