![curl 無法向 FTPS 傳送文件](https://rvso.com/image/1157734/curl%20%E7%84%A1%E6%B3%95%E5%90%91%20FTPS%20%E5%82%B3%E9%80%81%E6%96%87%E4%BB%B6.png)
嘗試將“test_file”傳送到 FTPS 伺服器。
curl -v -k --ftp-ssl --tlsv1 --ftp-ssl-reqd --ftp-pasv --key key_nopass.pem --cert client.pem --user 'user:pass' --upload-file test_file ftp://Ftps.example.com:21/
它連接,但之後失敗。這是一些輸出:
> * Connected to EXAMPLE.COM_IP_ADDRESS (IP_ADDRESS) port 21 (#0)
> < 220 Microsoft FTP Service
> > AUTH SSL
> < 234 AUTH command ok. Expecting TLS Negotiation.
> * successfully set certificate verify locations:
> USER username
< 331 Password required for username.
> PASS thepassword
< 230 User logged in.
> PBSZ 0
< 200 PBSZ command successful.
> PROT P
< 200 PROT command successful.
> PWD
< 257 "/" is current directory.
* Entry path is '/'
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||5013|)
* Trying example.com.ip.addess
0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:03:09 --:--:-- 0* Connection timed out
* couldn't connect to host
* got positive EPSV response, but can't connect. Disabling EPSV
> PASV
* response reading failed
0 0 0 0 0 0 0 0 --:--:-- 0:03:09 --:--:-- 0
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
} [data not shown]
curl: (56) response reading failed
似乎在“連接到EXAMPLE.COM_IP_ADDRESS(IP_ADDRESS))”和“登入”之後,它說“無法連線到主機“,儘管如此,上面幾行似乎是有聯繫的”
更新:使用“--disable-epsv”參數來運行相同的命令,似乎它也在嘗試打開資料通道連接埠:
* Connect data stream passively
< 227 Entering Passive Mode (A,B,C,D,19,179).
其中A、B、C、D是伺服器的IP,我認為其他的:19,179是連接埠。正確的? PS:每次執行指令時,最後一個數字(179)都會增加 1。