Behavior of `curl` and `sudo curl` is different when testing API


I’ve been having a lot of trouble getting various API wrappers working on my computer, and I think I’ve narrowed down the problem, or at least identified a problem.

I went to oauth tools and constructed a query, and then copied the curl command to my command line.

The regular curl failed as follows:

`* Hostname was NOT found in DNS cache

  • Trying…
  • Connected to ( port 443 (#0)
  • error setting certificate verify locations:
    CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none
  • Closing connection 0
    curl: (77) error setting certificate verify locations:
    CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none`

However, running sudo curl worked just fine, and I received the expected output.

I can’t figure out why this is the case, and it doesn’t yet help me with getting my API wrapper calls working, since I can’t elevate a python script with sudo.

I’m running Ubuntu 14.10 if that helps.




According to this Stack Overflow answer you need to install the ca-certificates with apt-get.


I already had that installed, but that ended up leading me to a fix:

I found the CA cert bundle in:
which is where ca-certificates puts its certs.

I then made a symlink to the place that curl was expecting to find the certs:

It worked just fine after that. It seems to be an issue with Ubuntu more so than anything.

Thank you for your help!