1

I've got a CentOS 7 machine, running inside a Docker container.

I'm developing an application that will have to connect to an FTP Server, and download some files - to do that, I need to set my FTP connection to passive mode. Unfortunately, this machine seems unable to use FTP Passive Mode at all. Whatever client I try to use, I always obtain the same error:

ftp> open ftp
Connected to ftp (172.18.0.8).
220 (vsFTPd 3.0.3)
Name (ftp:root): admin
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (10,105,125,200,185,104).
ftp: connect: No route to host

Here the logs from the FTP server:

Tue Jun 19 12:36:32 2018 [pid 20820] CONNECT: Client "172.18.0.7"
Tue Jun 19 12:36:32 2018 [pid 20820] FTP response: Client "172.18.0.7", "220 (vsFTPd 3.0.3)"
Tue Jun 19 12:36:34 2018 [pid 20820] FTP command: Client "172.18.0.7", "USER admin"
Tue Jun 19 12:36:34 2018 [pid 20820] [admin] FTP response: Client "172.18.0.7", "331 Please specify the password."
Tue Jun 19 12:36:38 2018 [pid 20820] [admin] FTP command: Client "172.18.0.7", "PASS <password>"
Tue Jun 19 12:36:38 2018 [pid 20819] [admin] OK LOGIN: Client "172.18.0.7"
Tue Jun 19 12:36:38 2018 [pid 20821] [admin] FTP response: Client "172.18.0.7", "230 Login successful."
Tue Jun 19 12:36:38 2018 [pid 20821] [admin] FTP command: Client "172.18.0.7", "SYST"
Tue Jun 19 12:36:38 2018 [pid 20821] [admin] FTP response: Client "172.18.0.7", "215 UNIX Type: L8"
Tue Jun 19 12:36:43 2018 [pid 20821] [admin] FTP command: Client "172.18.0.7", "PASV"
Tue Jun 19 12:36:43 2018 [pid 20821] [admin] FTP response: Client "172.18.0.7", "227 Entering Passive Mode (10,105,125,200,185,104)." 

Using the same credentials, hostname (10.105.125.200 is an address inside my local network) and port (21), I have no trouble using passive mode from other machines that also run in Docker. For example, on a Debian machine, this problem does not occur.

I've tried the following fix: https://linuxconfig.org/rhel7-ftp-server-error-ftp-connect-no-route-to-host-solution but since the machine runs on Docker, it does not have the full possibilities of a raw machine (at least, not out of the box)-> For example, I'm unable to run iptables.

I've also found suggestions that maybe the CentOS firewall is blocking something - but, the problem of the machine being inside Docker also stopped me here, since I can't use basic programs like systemctl.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.