![Azure VM 的 FTP 问题](https://linux22.com/image/603058/Azure%20VM%20%E7%9A%84%20FTP%20%E9%97%AE%E9%A2%98.png)
我正在尝试使用 Server2012 在我的 Azure VM 上运行有效的 FTP 脚本。
本次测试中所有防火墙均已关闭。端口 20/21 是开放端点。
OPEN ftp.domain.co.uk
user
password
cd current
binary hash
prompt n
quote pasv
MGET *.*
QUIT
回复:
ftp> OPEN ftp.domain.co.uk
Connected to ftp.domain.co.uk.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 2 of 50 allowed.
220-Local time is now 15:15. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
User (ftp.domain.co.uk:(none)):
331 User xxxxxxx OK. Password required
230-User xxxxxxxxx has group access to: ftpgroup
230-OK. Current directory is /
230-All usage is logged for security and statistical analysis purposes.
230 Do not exceed one download set per 10 minute interval.
ftp> cd current
250 OK. Current directory is /current
ftp> binary hash
200 TYPE is now 8-bit binary
ftp> prompt n
Interactive mode Off .
ftp> quote pasv
227 Entering Passive Mode (85,17,xx,xxx,197,86)
ftp> MGET *.*
I won't open a connection to 10.140.x.xx (only to 168.63.xxx.xxx)
200 TYPE is now 8-bit binary
Cannot find list of remote files.
ftp> QUIT
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
如您所见,MGET 命令存在问题。
我已尝试使用 PORT xx,xx,xxx,xxx,xx,xx 发出活动命令,但在 FTP 客户端的该行之后收到无效命令。
Filezilla 通过端口 21 成功连接。
答案1
我觉得 Windows FTP 不能正确执行被动 FTP,所以我最终用 C# 编写了自己的 FTP 程序来强制使用被动模式。这样就没问题了。