4

I'm getting an error in WSL while trying to download using wget

 wget -O quotefile.txt "https://www.google.com"

Output

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]

Why i am getting this error

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.

and how to solve this ?

I am facing this problem after fresh reinstall.Earlier I was using Windows 10 Pro Version 19035 but right now i am using Windows 10 Pro Version 1909.

3
  • Do you mean 1903? HSTS is a security feature designed to insure website domains go to their proper location. You must configure wget to work with a secure connection. Try --no-check-certificate – Ramhound Apr 8 '20 at 13:14
  • @Ramhound --no-check-certificates disables tls cert check completely which is dangerous and not necessary as you can just disable hsts using --no-hsts – Robert Apr 8 '20 at 13:28
  • @Robert - Sounds like you should answer the question. I only suggested a possible solution as I wasn’t sure – Ramhound Apr 8 '20 at 13:39
2

HSTS is an optional security measurement on top on HTTPS. As the HTTPS connection itself works and the file has been downloaded this seems to be rather a warning than an error. Therefore I see three options:

  1. Disable HSTS on each call using the wget option --no-hsts
  2. Try to create a file in /home/atul/.wget-hsts with the appropriate permissions and try if wget makes use of this file
  3. Just ignore this warning
6

I just came across the issue myself and in my case the .wget-hsts file was group and world writeable. I've just limited it to be user writable and the error vanished:

Before

-rw-rw-rw-  1 matthias matthias  165 Mar 13 13:57 .wget-hsts

After

-rw-r--r--  1 matthias matthias  165 Mar 13 13:57 .wget-hsts
1
  • 5
    This fixed it for me. For reference, running chmod 644 .wget-hsts will do the job of setting the file to user writable. – Cobra Sep 3 '20 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.