Wget error bash Windows Subsystem for Linux

6,963

Solution 1

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

Solution 2

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
Share:
6,963

Related videos on Youtube

Madhubala
Author by

Madhubala

Updated on September 18, 2022

Comments

  • Madhubala
    Madhubala over 1 year

    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.

    • Ramhound
      Ramhound about 4 years
      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
    • Robert
      Robert about 4 years
      @Ramhound --no-check-certificates disables tls cert check completely which is dangerous and not necessary as you can just disable hsts using --no-hsts
    • Ramhound
      Ramhound about 4 years
      @Robert - Sounds like you should answer the question. I only suggested a possible solution as I wasn’t sure
  • Cobra
    Cobra over 3 years
    This fixed it for me. For reference, running chmod 644 .wget-hsts will do the job of setting the file to user writable.