[fpc-pascal] Access GPIO pins on RPi2 without root?

Lukasz Sokol el.es.cr at gmail.com
Wed Oct 7 10:01:56 CEST 2015

On 07/10/15 08:02, Bo Berglund wrote:
> How can one control the GPIO outputs on a Raspberry Pi2 without
> needing the program to run as root? I am using Raspbian Wheezy and I
> need to add two relays controls to my program.
> The pages I have found with google are for the original Pi so the
> connector referenced is the wrong size and it is also always mentioned
> that the program must be run as root.
> My program must be started every minute by cron so I don't know how
> this will happen...
> (Not so used to Linux)
> Do I need to install some driver in Raspbian to allow access to the
> GPIO ports from FPC?

Apart from running SUID Root, which is generally discouraged (there is lots of answers on why setuid root is bad)

I'd probably search for some udev rules to make up - to chown the gpio
devices in /dev to root:gpio, (for example) and your unprivileged user to
be a member of group gpio;

( possibly https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=9667, but
also worth checking out other https://www.google.com/search?q=raspberry+pi+udev+gpio+user&ie=utf-8&oe=utf-8 results.)

el es

More information about the fpc-pascal mailing list