Windows 200端口命令成功。考虑使用PASV。425未能建立连接

Windows 200端口命令成功。考虑使用PASV。425未能建立连接,windows,ftp,Windows,Ftp,我在Ubuntu12.04LTS中安装了FTP服务器 现在,当我尝试通过命令行FTP.exe从Windows 7连接到FTP服务器时,我成功连接,但无法获取目录列表。我犯了一个错误 200 PORT command successful. Consider using PASV. 425 Failed to establish connection. 在使用ls之前,请尝试使用passive命令 从FTP客户端,要检查FTP服务器是否支持被动模式,请在登录后键入quote PASV 以下是被

我在Ubuntu12.04LTS中安装了FTP服务器

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

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

在使用
ls
之前,请尝试使用
passive
命令

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

以下是被动模式打开和关闭时vsftpd服务器的连接示例

vsftpd
pasv\u 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> 
vsftpd
带有
pasv\u 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> 

在使用
ls
之前,请尝试使用
passive
命令

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

以下是被动模式打开和关闭时vsftpd服务器的连接示例

vsftpd
pasv\u 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> 
vsftpd
带有
pasv\u 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

由于防火墙和NAT的存在,现在在主动模式下设置FTP可能会很麻烦

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

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

见我的文章


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

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

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

例如,默认为被动模式,并且有一个可用于转换的指南


(我是WinSCP的作者)

实际上,您的Windows防火墙正在阻止连接。您需要从管理员处将这些命令输入到
cmd.exe

netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=tcp
netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=udp
如果出现问题,您可以通过以下方式恢复:

netsh advfirewall firewall delete rule name="FTP" program=%SystemRoot%\System32\ftp.exe

实际上,您的Windows防火墙正在阻止连接。您需要从管理员处将这些命令输入到
cmd.exe

netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=tcp
netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=udp
如果出现问题,您可以通过以下方式恢复:

netsh advfirewall firewall delete rule name="FTP" program=%SystemRoot%\System32\ftp.exe

你需要使用被动模式

如果您使用的是linux客户端,请使用
pftp
ftp-p

手动ftp

-p    Use passive mode for data transfers. Allows use of ftp in environments where a firewall prevents connections from the outside world back to the client machine. Requires that the ftp server support the PASV command. This is the default if invoked as pftp.

你需要使用被动模式

如果您使用的是linux客户端,请使用
pftp
ftp-p

手动ftp

-p    Use passive mode for data transfers. Allows use of ftp in environments where a firewall prevents connections from the outside world back to the client machine. Requires that the ftp server support the PASV command. This is the default if invoked as pftp.

对我有效的只是键入被动命令,ftp从主动模式进入被动模式。

对我有效的是键入被动命令,ftp从主动模式进入被动模式。

禁用Windows防火墙,然后在cmd中再次运行ftp命令,它将工作

禁用Windows防火墙,在cmd中再次运行ftp命令后,它将工作

quote PASV
将不起作用。它仅将服务器切换到被动模式。但不是客户。看@MartinPrikryl我不确定你是否读过我的答案。而且,人们似乎一直在编辑我的答案。但是,关于Windows命令提示符,你是对的。是的,我读了你的答案。这个问题是关于Windows
ftp.exe
(我试图通过命令行从Windows 7连接到ftp服务器)。在Windows
ftp.exe
中,没有
被动
命令,甚至不支持被动模式。所以你的答案与问题无关。是的。我对你的答案投赞成票。我只是想说清楚,我并不是说
quote PASV
会有帮助。
quote PASV
不会有帮助。它仅将服务器切换到被动模式。但不是客户。看@MartinPrikryl我不确定你是否读过我的答案。而且,人们似乎一直在编辑我的答案。但是,关于Windows命令提示符,你是对的。是的,我读了你的答案