whenever I use curl it tries to connect to tor service by default. my tor service is turned off and network proxy is disabled in network settings.

here is the output of the command curl google.com:

curl: (7) Failed to connect to port 9050: Connection refused

I didn't change any configuration of curl to use Tor.

my OS is ubuntu 17.10

How can I fix it?

  • 1
    Try using "curl --noproxy * google.com" This will disable the use of a proxy server for all addresses. – Raman Sailopal Jan 5 '18 at 10:59

Check your environment variables with some command as env at the command interface line. Perhaps some variable as http_proxy or HTTPS_PROXY is set.

Another way to bypass the setting of these environment variables is to launch curl --noproxy '*' google.com to see if the unwanted behaviour still happens.

The curl command has also a configuration file where some options can be set (See ~/.curlrc in the cse of default settings).

  • I don't have such environment variables. --noproxy flag also returns curl: no URL specified!. I don't have any ~/.curlrc nor configuration under /etc – Yashar Jan 5 '18 at 10:54
  • The --noproxy flag must be followed by a wildcard, v.gr. *, otherwise www.google.com will be considered as the argument of --noproxy and curl will return 'no URL specified!'. I eddited my answer above. See the correct way to launch curl and escape the *. – Pierre François Jan 5 '18 at 11:00
  • that solved my problem thanks! but is there any way to use curl without this flag? there are lots of scripts which use curl and its hard to change them to use this flag – Yashar Jan 5 '18 at 11:05
  • You can define these settings in the ~/.curlrc configuration file. – Pierre François Jan 5 '18 at 11:28

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.