如何为wget提供用户名和密码?

我试图通过wget连接到服务器:

wget http://:@serveradress 

但是wget响应:无效的端口

我知道服务器接受端口80的传入流量。如何解决此问题?

Wget将@serveraddress解释为port。 要指定用户名和密码,请使用--user--password开关:

 wget --user user --password pass http://example.com/ 

man wget

--user=user

--password=password

指定FTP和HTTP文件检索的用户名和密码密码 。 可以使用FTP连接的--http-user--http-password选项以及HTTP连接的--http-user--http-password选项覆盖这些参数。

你有3个选项,除了胆量之外没有特定的顺序:

1 /密码对任何人都可见(使用命令history

 me@machine:~$ wget --user=remote_user --password=SECRET ftp://ftp.example.com/file.ext 

密码也将在ps,top,htop等中可见。

2 /肩膀后面的任何人都可以看到密码

 me@machine:~$ wget --user=remote_user --password=SECRET ftp://ftp.example.com/file.ext 

注意命令前的空格,它会阻止将其保存到历史记录中

密码也将在ps,top,htop等中可见。

3 /包括您在内的任何人都无法看到密码

 me@machine:~$ wget --user=remote_user --ask-password ftp://ftp.example.com/file.ext Password for user `remote_user': [SECRET (not visible)] 

该命令可以使用--http-user--http-password而不是--user--password 。 在ftp请求的情况下,选项是--ftp-user--ftp-password

我已经登录,在Chrome浏览器中开始下载并从下载标签中复制下载链接,它应该包含授权参数,请看这个图片:

如何获取Chrome下载链接

linke应该类似于: http : //download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_database.zip? AuthParam=1539333101_448acded002c607377c51b62730a816f

暂停Chrome中的下载,只需在Linux机器中输入以下内容:

 wget http://download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_database.zip?AuthParam=1539333101_448acded002c607377c51b62730a816f 

像魅力:)工作。 我正在从这个下载Oracle数据库: https : //www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html到Ubuntu。

它可能不会适用于每个案例,但对我的情况工作正常:)