windows 200 PORT 命令成功。考虑使用 PASV。425 建立连接失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19516263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
200 PORT command successful. Consider using PASV. 425 Failed to establish connection
提问by CY5
I have setup FTP server in Ubuntu 12.04 LTS.
我在 Ubuntu 12.04 LTS 中设置了 FTP 服务器。
Now when when I try to connect to FTP server from Windows 7 through command-line ftp.exe
, I get successfully connected but I cannot get the list of directory. I get error
现在,当我尝试通过命令行从 Windows 7 连接到 FTP 服务器时ftp.exe
,我成功连接但无法获取目录列表。我得到错误
200 PORT command successful. Consider using PASV.
425 Failed to establish connection.
采纳答案by Shannon
Try using the passive
command before using ls
.
passive
在使用之前尝试使用该命令ls
。
From FTP client, to check if the FTP server supports passive mode, after login, type quote PASV
.
从 FTP 客户端,检查 FTP 服务器是否支持被动模式,登录后输入quote PASV
.
Following are connection examples to a vsftpd server with passive mode on and off
以下是打开和关闭被动模式的 vsftpd 服务器的连接示例
vsftpd
with pasv_enable=NO
:
vsftpd
与pasv_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
with pasv_enable=YES
:
vsftpd
与pasv_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>
回答by Martin Prikryl
You are using the FTP in an active mode.
您正在以主动模式使用 FTP。
Setting up the FTP in the active mode can be cumbersome nowadays due to firewalls and NATs.
由于防火墙和 NAT,如今在主动模式下设置 FTP 可能很麻烦。
It's likely because of your local firewall or NAT that the server was not able to connect back to your client to establish data transfer connection.
很可能由于您的本地防火墙或 NAT,服务器无法连接回您的客户端以建立数据传输连接。
Or your client is not aware of its external IP address and provides an internal address instead to the server (in PORT
command), which the server is obviously not able to use. But it should not be the case, as vsftpd by default rejects data transfer address not identical to source address of FTP control connection (the port_promiscuous
directive).
或者您的客户端不知道其外部 IP 地址,而是向服务器提供内部地址(在PORT
命令中),服务器显然无法使用该地址。但事实并非如此,因为默认情况下 vsftpd 拒绝与 FTP 控制连接(port_promiscuous
指令)的源地址不同的数据传输地址。
See myarticle Network Configuration for Active Mode.
请参阅我的文章主动模式的网络配置。
If possible, you should use a passive mode as it typically requires no additional setup on a client-side. That's also what the server suggested you by "Consider using PASV". The PASV
is an FTP command used to enter the passive mode.
如果可能,您应该使用被动模式,因为它通常不需要在客户端进行额外设置。这也是服务器通过“考虑使用 PASV”向您建议的内容。这PASV
是用于进入被动模式的 FTP 命令。
Unfortunately Windows FTP command-line client (the ftp.exe
) does not support passive mode at all. It makes it pretty useless nowadays.
不幸的是,Windows FTP 命令行客户端 (the ftp.exe
) 根本不支持被动模式。这使它在今天非常无用。
Use any other 3rd party Windows FTP command-line client instead. Most other support the passive mode.
请改用任何其他第 3 方 Windows FTP 命令行客户端。大多数其他支持被动模式。
For example WinSCP FTP clientdefaults to the passive mode and there's a guide available for converting Windows FTP script to WinSCP script.
例如WinSCP FTP 客户端默认为被动模式,并且有一个指南可用于将Windows FTP 脚本转换为 WinSCP 脚本。
(I'm the author of WinSCP)
(我是 WinSCP 的作者)
回答by Manoj Singh Bisht
Actually your window firewall blocking the connection so you need to Enter these commands into cmd.exe from Administrator.
实际上,您的窗口防火墙阻止了连接,因此您需要从管理员将这些命令输入到 cmd.exe 中。
1) netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=tcp
1) netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=tcp
2) netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=udp
2) netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=udp
if in case something goes wrong then you can revert by this:
如果出现问题,那么您可以通过以下方式恢复:
1) netsh advfirewall firewall delete rule name="FTP" program=%SystemRoot%\System32\ftp.exe
1) netsh advfirewall firewall delete rule name="FTP" program=%SystemRoot%\System32\ftp.exe
回答by Rusher
You need to use passive mode.
您需要使用被动模式。
If you're using linux client, use pftp
or ftp -p
.
如果您使用的是 linux 客户端,请使用pftp
或ftp -p
。
From man ftp
:
来自man 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.