带有用户名和密码的 HTTPS 的正确 wget 命令语法是什么? [英] What is the correct wget command syntax for HTTPS with username and password?

查看:25
本文介绍了带有用户名和密码的 HTTPS 的正确 wget 命令语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 wget 通过此 URL 远程下载文件:

I would like to download a file remotely with this URL using wget:

https://test.mydomain.com/files/myfile.zip

站点 test.mydomain.com 需要登录.我想使用此命令在我的另一台服务器中下载该文件,但它不起作用(未完全下载文件):

The site test.mydomain.com requires a login. I would like to download that file in my another server using this command but it does not work (does not completely download the file):

wget --user=myusername --password=mypassword https://test.mydomain.com/files/myfile.zip

如果我的用户名是 myusername,密码是 mypassword,那么正确的 wget 语法是什么?

If my username is myusername and password is mypassword what would be the correct wget syntax?

以下是我输入上述命令后的返回信息:

The following are the return messages after I type the above command:

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'

我错过了什么吗?请帮忙.谢谢.

Am I missing something? Please help. Thanks.

推荐答案

通过指定选项 --user 和 --ask-password wget 将要求提供凭据.下面是一个例子.根据您的需要更改用户名和下载链接.

By specifying the option --user and --ask-password wget will ask for the credentials. Below is an example. Change the username and download link to your needs.

wget --user=username --ask-password https://xyz.com/changelog-6.40.txt

这篇关于带有用户名和密码的 HTTPS 的正确 wget 命令语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆