如何从 Curl 获取有关 FTP 425“无法打开数据连接”错误的更多信息?

如何从 Curl 获取有关 FTP 425“无法打开数据连接”错误的更多信息?

我正在尝试上传包含以下行的文件:

curl -3 --ftp-pasv --ftp-ssl-control -v -i -T ./mybigfile.gz ftp://[email protected]:21/OnlineBackup/Lawrence/ --insecure -u 'zzzzzzz:YYYYYY'

但是我收到一个协议错误 - 但不知道错误可能是什么 - 我如何才能获得更多信息?

STATE: INIT => CONNECT handle 0x60002e180; line 1026 (connection #-5000)
* Hostname was NOT found in DNS cache
*   Trying 9.109.10.66...
* STATE: CONNECT => WAITCONNECT handle 0x60002e180; line 1073 (connection #0)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to mecloud.xxxxxxx.co.uk (9.109.10.66) port 21 (#0)
* FTP 0x60006bca0 (line 3168) state change from STOP to WAIT220
* STATE: WAITCONNECT => PROTOCONNECT handle 0x60002e180; line 1186 (connection #0)
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< 220 Microsoft FTP Service
> AUTH SSL
* FTP 0x60006bca0 (line 2728) state change from WAIT220 to AUTH
< 234 AUTH command ok. Expecting TLS Negotiation.
* successfully set certificate verify locations:
*   CAfile: /usr/ssl/certs/ca-bundle.crt
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using SSLv3 / DES-C-SHA
* Server certificate:
*        subject: CN=cs43731260.xxxxxx.local
*        start date: 2013-05-31 21:52:35 GMT
*        expire date: 2014-05-31 00:00:00 GMT
*        issuer: CN=cs43731260.xxxxxxx.local
*        SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> USER zzzzzzzz
* FTP 0x60006bca0 (line 840) state change from AUTH to USER
< 331 Password required for zzzzzzzz.
> PASS yyyyyyyy
* FTP 0x60006bca0 (line 2601) state change from USER to PASS
< 230 User logged in.
> PBSZ 0
* FTP 0x60006bca0 (line 2577) state change from PASS to PBSZ
< 200 PBSZ command successful.
> PROT C
* FTP 0x60006bca0 (line 2787) state change from PBSZ to PROT
< 200 PROT command successful.
> PWD
* FTP 0x60006bca0 (line 852) state change from PROT to PWD
< 257 "/" is current directory.
* Entry path is '/'
* FTP 0x60006bca0 (line 2918) state change from PWD to STOP
* protocol connect phase DONE
* STATE: PROTOCONNECT => DO handle 0x60002e180; line 1205 (connection #0)
* DO phase starts
> CWD OnlineBackup
* FTP 0x60006bca0 (line 929) state change from STOP to CWD
* ftp_perform ends with SECONDARY: 0
* STATE: DO => DOING handle 0x60002e180; line 1265 (connection #0)
< 250 CWD command successful.
> CWD Lawrence
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0< 250 CWD command successful.
> EPSV
* FTP 0x60006bca0 (line 1357) state change from CWD to PASV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||63307|)
* Hostname was NOT found in DNS cache
*   Trying 9.109.10.66...
* Connecting to 9.109.10.66 (9.109.10.66) port 63307
* FTP 0x60006bca0 (line 2063) state change from PASV to STOP
* DO phase is complete2
* STATE: DOING => DO_MORE handle 0x60002e180; line 1353 (connection #0)
* Connected to mecloud.xxxxxxx.co.uk (9.109.10.66) port 21 (#0)
* DO-MORE connected phase starts
> TYPE I
* FTP 0x60006bca0 (line 3502) state change from STOP to STOR_TYPE
< 200 Type set to I.
> STOR mybigfile.gz
* FTP 0x60006bca0 (line 1692) state change from STOR_TYPE to STOR
< 150 Opening BINARY mode data connection.
* FTP 0x60006bca0 (line 526) state change from STOR to STOP
* STATE: DO_MORE => DO_DONE handle 0x60002e180; line 1379 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x60002e180; line 1404 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x60002e180; line 1417 (connection #0)
} [data not shown]
* We are completely uploaded and fine
* STATE: PERFORM => DONE handle 0x60002e180; line 1587 (connection #0)
* Remembering we are in dir "OnlineBackup/Lawrence/"
< 425 Cannot open data connection.
* server did not report OK, got 425
100    90    0     0  100    90      0     48  0:00:01  0:00:01 --:--:--    48
* Connection #0 to host mecloud.xxxxxxxx.co.uk left intact
curl: (18) server did not report OK, got 425

$

答案1

您的计算机在连接​​服务器端口时出现问题63307,可能是某处的防火墙。

确保1024服务器上的所有端口均可访问,或者确保客户端不在路由器后面,并且客户端上的所有端口均可访问(不受防火墙保护)并使用主动模式(如果服务器支持)。

此链接可能会提供一些见解 - 客户端由于某种原因无法建立数据连接(被动图上的连接#3)

相关内容