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

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Oct 7 10:30:51 CEST 2015


leledumbo wrote:
>> How can one control the GPIO outputs on a Raspberry Pi2 without needing the
> program to run as root?
> 
> sudo chown root <program name>
> sudo chmod 4755 <program name>
> 
> The 4 is setuid bit, which will allow normal users to run the program but
> the program itself has root privilege.

With the caveat that running setuid root is incompatible with at least 
some versions of GTL, it's necessary to use Qt instead.

"The unix way" for this would be to have a driver that exposes the GPIO 
pins somewhere in /dev, with appropriate group ownership to which select 
users could be added.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list