0

I have written a program in C++ in which I am exporting GPIOs of a Raspberry Pi running Raspbian Wheezy, and sending some data to a server through Curl. When I run the executable with sudo, I do not get any response in Curl (like success). When I run without sudo, the curl is working fine giving a response(success), but unfortunately the GPIOs are unable to export because I am running it without sudo. It says something like 'permission denied to export'.

Please help me on this

  • 1
    Are you fork/exec()ing curl(1) or calling through the libcurl api? If the former, what status are you getting on the exec call (it should not return if the exec succeeded, e.g.). – BJ Black Jun 5 '17 at 6:07
0

If all you are doing is manipulating the GPIO there is no reason to be using root privileges with Raspbian.

This is a common use and is provided for in the permissions system.

Add the user to group gpio and you will not need to use sudo.

To add the pi user to group gpio use the following command.

sudo adduser pi gpio

  • 2
    The OP claims to be using Wheezy, so he is probably using 2 year out of date libraries, which AFAIK needed permission. – Milliways Jun 5 '17 at 8:54
  • @Milliways Yes. I didn't notice the reference to wheezy. An upgrade to stretch might be sensible – joan Jun 5 '17 at 8:58

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.