适用于 Linux 的 Wget 错误 bash Windows 子系统

Mad*_*ala 4 linux bash wget ubuntu windows-subsystem-for-linux

我在尝试使用 wget 下载时在 WSL 中遇到错误

 wget -O quotefile.txt "https://www.google.com"
Run Code Online (Sandbox Code Playgroud)

输出

Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/home/atul/.wget-hsts'. HSTS will be disabled.
--2020-04-08 12:47:43--  https://www.google.com/
Resolving www.google.com (www.google.com)... 2404:6800:4002:80f::2004, 172.217.166.196
Connecting to www.google.com (www.google.com)|2404:6800:4002:80f::2004|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘quotefile.txt’

quotefile.txt                     [ <=>                                              ]  14.68K  --.-KB/s    in 0.002s

2020-04-08 12:47:45 (6.43 MB/s) - ‘quotefile.txt’ saved [15029]
Run Code Online (Sandbox Code Playgroud)

为什么我收到这个错误

Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/home/atul/.wget-hsts'. HSTS will be disabled.
Run Code Online (Sandbox Code Playgroud)

以及如何解决这个问题?

重新安装后我遇到了这个问题。之前我使用的是 Windows 10 专业版 19035,但现在我使用的是 Windows 10 专业版 1909。

小智 6

我自己刚刚遇到了这个问题,就我而言,该.wget-hsts文件是组和全局可写的。我只是将它限制为用户可写并且错误消失了:

-rw-rw-rw-  1 matthias matthias  165 Mar 13 13:57 .wget-hsts
Run Code Online (Sandbox Code Playgroud)

-rw-r--r--  1 matthias matthias  165 Mar 13 13:57 .wget-hsts
Run Code Online (Sandbox Code Playgroud)

  • 这为我修好了。作为参考,运行 `chmod 644 .wget-hsts` 将完成将文件设置为用户可写的工作。 (5认同)

Rob*_*ert 4

HSTS 是 HTTPS 之上的可选安全测量。由于 HTTPS 连接本身正常工作并且文件已下载,这似乎是一个警告而不是错误。因此我看到三个选择:

  1. 使用 wget 选项在每次调用时禁用 HSTS--no-hsts
  2. 尝试使用适当的权限创建一个文件/home/atul/.wget-hsts,并尝试 wget 是否使用该文件
  3. 忽略这个警告即可