我使用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后才能工作。
您需要在您的proftd.conf启用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