Override WGET Certificate Errors

wget is a handy Linux command used to download files directly from the command line. It can be used to download just about any file from the Internet and beyond. Simple usage is just

wget URL

where URL is the url of the file you are looking to download.

There are times when a file is hosted on a server that has a self signed SSL certificate or an invalid certificate or even a certificate that is not trusted by the local computer. When this happens, an error is thrown and wget does not download the requested file.

A wget certificate error can look like this:

wget https://example.com/images/logo.png
--2017-03-03 13:10:27-- https://example.com/images/logo.png
Resolving example.com (example.com)... 10.0.0.2
Connecting to example.com (example.com)|10.0.0.2|:443... connected.
ERROR: The certificate of `example.com' is not trusted.
ERROR: The certificate of `example.com' hasn't got a known issuer.

The fix to these kinds of errors is to use the –no-check-certificate flag

wget --no-check-certificate URL

Doing this will throw a warning instead of an error, and allow you to download the file.

If you are often downloading things using wget and get certificate errors, you can add the following parameter to your wget config file, which is usually at ~/.wgetrc:

check_certificate=off

I do not recommend doing so for security reasons, but the option is there. `

Leave a Reply

Your email address will not be published. Required fields are marked *