200 PORT命令成功。 考虑使用PASV。 425无法build立连接

我已经在Ubuntu 12.04 LTS中安装了FTP服务器。

现在,当我尝试从Windows 7通过命令行ftp.exe连接到FTP服务器时,我成功连接,但无法获取目录列表。 我得到错误

 200 PORT command successful. Consider using PASV. 425 Failed to establish connection. 

在使用ls之前尝试使用passive命令。

从FTP客户端,检查FTP服务器是否支持被动模式,登录后键入quote PASV

以下是连接到具有被动模式的vsftpd服务器的例子

vsftpdpasv_enable=NO

 # ftp localhost Connected to localhost.localdomain. 220 (vsFTPd 2.3.5) Name (localhost:john): anonymous 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> quote PASV 550 Permission denied. ftp> 

vsftpdpasv_enable=YES

 # ftp localhost Connected to localhost.localdomain. 220 (vsFTPd 2.3.5) Name (localhost:john): anonymous 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> quote PASV 227 Entering Passive Mode (127,0,0,1,173,104). ftp> 

您正在使用活动模式下的FTP。

由于防火墙和NAT,现在在主动模式下建立FTP可能是麻烦的。

这可能是因为您的本地防火墙或NAT,服务器无法连接回您的客户端建立数据传输连接。

或者您的客户端不知道其外部IP地址,而是向服务器提供一个内部地址(在PORT命令中),而服务器显然无法使用该地址。 但事实并非如此,因为vsftpd默认拒绝与FTP控制连接( port_promiscuous指令)的源地址不同的数据传输地址。

请参阅我的文章活动模式的网络配置 。


如果可能的话,您应该使用被动模式,因为它通常不需要在客户端进行额外的设置。 这也是服务器通过“考虑使用PASV”所建议的。 PASV是用于进入被动模式的FTP命令。

不幸的是Windows FTP命令行客户端( ftp.exe )根本不支持被动模式。 这使得它现在很无用。

使用任何其他第三方Windows FTP命令行客户端。 大多数其他支持被动模式。

例如, WinSCP FTP客户端默认为被动模式,可以将Windows FTP脚本转换为WinSCP脚本 。

(我是WinSCP的作者)

其实你的窗口防火墙阻止连接,所以你需要输入这些命令到管理员的cmd.exe。

1)netsh advfirewall firewall add rule name =“FTP”dir = in action = allow program =%SystemRoot%\ System32 \ http://ftp.exe enable = yes protocol = tcp

2)netsh advfirewall防火墙添加规则名称=“FTP”dir =在行动=允许程序=%SystemRoot%\ System32 \ http://ftp.exe启用=是协议= udp

如果万一出现问题,那么你可以通过这个恢复:

1)netsh advfirewall防火墙删除规则名称=“FTP”程序=%SystemRoot%\ System32 \ http://ftp.exe