CURL ERROR 7 Failed to connect to Permission denied

“CURL ERROR 7 Failed to connect to Permission denied” error is caused, when for any reason curl request is blocked by some firewall or similar thing.

you will face this issue when ever the curl request is not with standard ports.

for example if you do curl to some URL which is on port 1234, you will face this issue where as URL with port 80 will give you results easily.

Most commonly this error has been seen on CentOS and any other OS with ‘SElinux’.

you need to either disable or change  ‘SElinux’ to permissive

nano /etc/selinux/config

locate following line


Change this to


reboot is needed

17 thoughts on “CURL ERROR 7 Failed to connect to Permission denied

  1. Hi,
    I have a curl (7) error and tried everything so far in order to solve it without success.
    I’m running Centos and I was hoping that your post would be the answer to this issue but when I checked the selinux configuration file I saw that it was already set to disabled.

    Is there anything else you would recommend in order to solve this??


    1. Next thing you need to check is the iptables.
      please try listing iptables, and see what is there.

      iptables -L

      for testing just clear/Flush the iptables

      iptables -F

      once you flused the iptables, try the curl request.

      To my knowledge SELINUX and iptables are the reasons for CURL ERROR 7 on centOS,
      Hope this will help you.

  2. hi, i am facing this issue (permission denied error with curl) while connecting to google GCM service.I have tried various options, nothing worked.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.