Linux wget 和 htaccess:仅用户名

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8841187/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:03:05  来源:igfitidea点击:

wget and htaccess: username only

linuxubuntuwget

提问by Emil Avramov

I googled how to download images using terminal in ubuntu with wget. I found what I needed, but on the server, protected with .htaccess, there's no password. with

我在 ubuntu 中用 wget 搜索了如何使用终端下载图像。我找到了我需要的东西,但是在用 .htaccess 保护的服务器上,没有密码。和

wget admin@http://server.com/filename.jpg

wget admin@http://server.com/filename.jpg

it returns: No route to hosts. When I set a password and type

它返回:没有到主机的路由。当我设置密码并输入时

wget admin:password@http://server.com/filename.jpg

wget admin:password@http://server.com/filename.jpg

everything's fine. However I am not allowed to use a password on the server. How to fix it, finding route?

一切安好。但是我不允许在服务器上使用密码。如何修复它,找到路线?

回答by Marc B

Try

尝试

wget --user=admin http://server.com/filename.jpg

instead.

反而。

Alternatively,

或者,

wget http://admin:@server.com/filename.jpg

may work instead.

可能会起作用。

Your syntax is actually wrong, as its:

你的语法实际上是错误的,因为它:

wget http://user:pass@host/file

your username is outside the url, and was being treated as a hostname.

您的用户名在 url 之外,并被视为主机名。

回答by Andrea Puiatti

Much easier:

容易得多:

wget --user="username" --password="password" http://xxxx.yy/filename.xxx