Debian – FTP command line: Could not open data connection to port 48412: Connection timed out

csfdebianftpwebmin

I'm trying to send a file using ftp command line. It's working in my laptop by not in my vps server.

ftp -v -n <<EOF
open ftp.myserver.com
user username password
cd /folder/
put file.csv
EOF

I'm using a VM under proxmox running: debian 8, webmin and csf firewall. Don't know if it's blocked from the guest or host server.

This is the output of the command:

Connected to ftp.myserver.com.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 2 of 500 allowed.
220-Local time is now 16:57. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
331 User username  OK. Password required
230-Your bandwidth usage is restricted
230-OK. Current restricted directory is /
230 1394 Kbytes used (0%) - authorized: 153600000 Kb
Remote system type is UNIX.
Using binary mode to transfer files.
250 OK. Current directory is /folder
local: file.csv remote: file.csv
200 PORT command successful
425 Could not open data connection to port 48412: Connection timed out
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.

Best Answer

I fixed my issue by running this commande in the host server

modprobe ip_conntrack_ftp

than i added ip_conntrack_ftp to /etc/modules file (so it works after restart)