Debian

為什麼 ProFTPd 在 Windows Virtualbox 上的 Debian 上進入被動模式時停止?

  • March 24, 2016

我已經在裝有 Oracle Virtualbox 的 Windows 電腦上安裝了 Debian Squeeze。然後我在 NAT 適配器上轉發了埠 21。

在 Debian 中,我執行過:

apt-get install proftpd

然後我取消了 PassivePorts 的註釋,因此我將埠 49152 到 49155 用作被動埠。然後我取消註釋 MasqueradeAddress 並將其設置為 127.0.0.1

然後在 FileZilla 中嘗試快速連接後,我得到:

Status: Connecting to 127.0.0.1:21...
Status: Connection established, waiting for welcome message...
Response:   220 FTP Server ready.
Command:    USER webserver
Response:   331 Password required for webserver
Command:    PASS *
Response:   230 User webserver logged in
Command:    OPTS UTF8 ON
Response:   200 UTF8 set to on
Status: Connected
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/" is the current directory
Command:    TYPE I
Response:   200 Type set to I
Command:    PASV
Response:   227 Entering Passive Mode (127,0,0,1,192,3).
Command:    MLSD
Error:  Connection timed out
Error:  Failed to retrieve directory listing

如何解決這個問題?似乎它與虛擬機有關(現在在同一台機器上執行),因為那裡的所有教程都認為它應該在執行apt-get.

您需要PassivePorst在您的proftd.conf-

  PassivePorts      35000 40000

啟用ip_conntrack_ftp模組

  modprobe ip_conntrack_ftp 

在您的防火牆中,所有與 ftp/passive ftp 相關的埠都必須打開 -

iptables -A INPUT  -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT

iptables -A OUTPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT

iptables -A INPUT -p tcp --sport 20 -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A OUTPUT -p tcp --dport 20 -m state --state ESTABLISHED -j ACCEPT


iptables -A INPUT -p tcp --sport 1024: --dport 35000:40000  -m state --state ESTABLISHED -j ACCEPT

iptables -A OUTPUT -p tcp --sport 1024: --dport 35000:40000  -m state --state ESTABLISHED,RELATED -j ACCEPT

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