How to ignore invalid and self signed ssl connection errors with curl

I wanted to curl command to ignore SSL certification warning. Does curl command have a --no-check-certificate option like wget command on Linux or Unix-like system?

You need to pass the -k or --insecure option to the curl command. This option explicitly allows curl to perform “insecure” SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default.

Does curl have a –no-check-certificate option like wget command on Linux?

The syntax is as follows that allows curl command to work with “insecure” or “invalid” SSL certificates without https certicates:

curl -k url
curl --insecure url
curl --insecure [options] url
curl --insecure -I url

cURL ignore SSL certificate warnings command

In this example disable certificate verification for curl command:
curl --insecure -I
curl -k -O
Without the -k or --insecure option, you will get an error message that read as follows:

curl: (60) SSL certificate problem: Invalid certificate chain
More details here:

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

Here is one useful example where you want to grab a file or see header info from remote host without using SSL enabled SNI domain name:

curl -O --insecure --header 'Host:' -I
### OR ###
curl -k --header 'Host:' -I

Sample outputs:

Fig.01: Ignoring certificate warnings and saving the page or getting header info using curl command

How to apply the changes for all HTTPS connection

You can add insecure option to your $HOME/.curlrc file:
$ vi $HOME/.curlrc
Append the following:


Save and close the file. However, I do not recommend disabling SSL checks for all connections by default for security reasons.

How to specify CA to your trusted CA bundle for curl on the cli

One can try the following command for a self signed SSL/TLS certificates:
curl --cacert /pth/to/my/ca.pem https://url
curl --header 'Host:' --cacert /pth/to/my/ca.pem

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • Tricky Feb 24, 2017 @ 6:36

    I think it is important, whilst you are setting up your own services, to be able to connect even though you haven’t yet set up a proper certificate. With LetsEncrypt though, having curl permanently ignore security is particularly lazy.

    The alternative of course is having your system trust your own CA.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum