Debian

FTP 命令行:無法打開到埠 48412 的數據連接:連接超時

  • May 24, 2017

我正在嘗試使用 ftp 命令行發送文件。它不在我的 vps 伺服器上,而是在我的筆記型電腦上工作。

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

我在 proxmox 下使用虛擬機執行:debian 8、webmin 和 csf 防火牆。不知道它是否被訪客或主機伺服器阻止。

這是命令的輸出:

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.

我通過在主機伺服器中執行這個命令解決了我的問題

modprobe ip_conntrack_ftp

比我添加 ip_conntrack_ftp 到 /etc/modules 文件(所以它在重啟後工作)

引用自:https://serverfault.com/questions/851578