You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让wget在发送USER命令前先发送AUTH TLS以使用FTPS下载文件?

问题描述

我尝试使用wget从FTP服务器下载文件,执行命令:

wget --debug --no-passive-ftp --ftp-user=user --ftp-password=password ftp://server/file.gz file.gz

得到如下响应:

220 Private FTP server
Logging in as xxx ... 
--> USER xxx

331 Non-anonymous sessions must use encryption.

--> PASS xxx
Error in server response, closing control connection.

我可通过FileZilla正常连接并下载该服务器文件,其日志显示会先发送AUTH TLS建立TLS连接,再执行USER和PASS命令:

Response:   220 Private FTP server
Command:    AUTH TLS
Response:   234 Proceed with negotiation.
Status: Initializing TLS...
Status: Verifying certificate...
Status: TLS connection established.
Command:    USER xxx
Response:   331 Please specify the password.
Command:    PASS ******************

但下载任务需在无法使用FileZilla的远程服务器执行,请问如何让wget在发送USER命令前先发送AUTH TLS命令?

解决方案

wget默认不会主动发起FTP的TLS加密握手,你需要添加--ftp-ssl参数,强制wget在发送USER命令前先执行AUTH TLS加密流程。如果需要同时加密数据传输通道,还可以搭配--ftp-ssl-all参数。

修改后的完整命令如下:

wget --debug --no-passive-ftp --ftp-ssl --ftp-user=user --ftp-password=password ftp://server/file.gz file.gz

添加--ftp-ssl后,wget会先发送AUTH TLS命令,完成TLS握手并建立加密连接后,再执行USER和PASS登录操作,和FileZilla的行为完全一致,即可满足服务器对加密登录的要求。

内容的提问来源于stack exchange,提问作者Piotr

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 11:22:16