我想使用此URL使用wget远程下载文件:
https://test.mydomain.com/files/myfile.zip
站点test.mydomain.com需要登录。我想使用此命令在我的另一台服务器上下载该文件,但它不起作用(不能完全下载该文件):
wget --user=myusername --password=mypassword https://test.mydomain.com/files/myfile.zip
如果我的用户名是myusername,密码是mypassword,那么正确的wget语法是什么?
以下是我输入上述命令后的返回消息:
Resolving test.mydomain.com (test.mydomain.com)... 123.456.789
Connecting to test.mydomain.com (test.mydomain.com)|123.456.789|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://test.mydomain.com/login/unauthorized [following]
--2013-01-30 02:01:32-- https://test.mydomain.com/login/unauthorized
Reusing existing connection to test.mydomain.com:443.
HTTP request sent, awaiting response... 302 Found
Location: https://test.mydomain.com/login [following]
--2013-01-30 02:01:32-- https://test.mydomain.com/login
Reusing existing connection to test.mydomain.com:443.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `myfile.zip'
我是不是遗漏了什么?请帮帮忙。谢谢。
发布于 2013-01-30 02:19:47
通过指定选项--user和-- ask -password,wget将要求提供凭据。下面是一个例子。根据需要更改用户名和下载链接。
wget --user=username --ask-password https://xyz.com/changelog-6.40.txt
发布于 2013-06-11 18:26:33
我发现wget在某些服务器上不能正确地进行身份验证,可能是因为它只兼容HTTP 1.0。在这种情况下,curl (与HTTP 1.1兼容)通常可以做到这一点:
curl -o <filename-to-save-as> -u <username>:<password> <url>
发布于 2016-01-18 13:30:03
这并不是说你的文件被部分下载了。它无法通过身份验证,因此会下载例如"index.html“,但它将其命名为myfile.zip (因为这是您想要下载的内容)。
我关注了@thomasbabuj建议的链接,并最终找到了它。
您应该尝试添加--auth-no-challenge
,并建议替换您的密码条目
I.e
wget --auth-no-challenge --user=myusername --ask-password https://test.mydomain.com/files/myfile.zip
https://stackoverflow.com/questions/14595554
复制相似问题