[poky] Give others users than "root" access to GPIO (or commands)

Arno Steffens star at gmx.li
Wed May 30 03:20:19 PDT 2018



> Gesendet: Mittwoch, 30. Mai 2018 um 09:21 Uhr
> Von: "Richard Purdie" <richard.purdie at linuxfoundation.org>
> An: "Arno Steffens" <star at gmx.li>, "pokyyoctoproject.org" <poky at yoctoproject.org>
> Betreff: Re: [poky] Give others users than "root" access to GPIO (or commands)
>
> On Tue, 2018-05-29 at 12:41 +0200, Arno Steffens wrote:
> > I have to add a user other than root to start a program which
> > operates with i2c, spi, gpio.
> > For this I added an init-script /etc/rc5.d to make it /dev/* r/w for
> > "others".
> > That works for i2c and spi but not for GPIO. As most of the files the
> > user has to access will only created after the exporting the GPIOs
> > (more or less doing echo xxx > /sys/class/gpio/export).
> > But this new created /sys/class/gpio/xxx is not writable by user.
> > 
> > Maybe I am doing it completely wrong, but how can I achieve this to
> > become possible?
> > I checked the mega-manual, but there is not much mentioned about
> > groups (27.36. extrausers.bbclass).
> > Best regards
> > Arno
> > 
> > Maybe I also have to give this user the permission to reboot, which
> > is right now only possible for root
> 
> You have one reply/potential solution. Another option is to set udev
> rules (or the equivalent in systemd) such that when the device files
> are created they get the permissions/ownership you need.
> 
> Cheers,
> 
> Richard

Richard, what is regarding /dev I agree udev should be the way to go. Read about that but my first hours of experiments hasn't been successful. Have to try harder ...

But howto make commands like reboot, mount or shutdown to be executabel by others:
The setuid bit is already set for /sbin/shutdown.sysvinit which is linked to shutdown but is isn't working for other users than root.

Regards
Arno


More information about the poky mailing list