Lubuntu

Controlling the GPIO without root??

6 2359
funkey7  
Hello all,
I know that I can do that to switch gpio4 on:

$ sudo -i
$ echo "4" > /sys/class/gpio/export
$ echo "out" > /sys/class/gpio/gpio4/direction
$ echo "1" > /sys/class/gpio/gpio4/value

but this needs that i am logged in as root!

How can I do this without being root???

Wolf
run sudo command or su -

funkey7  
Well that is exacly what I want to avoid. With "sudo" or "su" I become root!!!!

I need to execute this without being root! I want to execute this as normal user!!!

To start, try to add your user to root as a secundary group.
sudo usermod -G root -a <user>
Otherwise you may try to add it as primary group.
sudo usermod -g root -a <user>

funkey7  
hello actkk2000

"sudo usermod -G root -a <user>"
gave no difference:
$ echo "4" > /sys/class/gpio/export
still shows me that I have no access. (as root everything works)

"sudo usermod -g root -a <user>"
gives an error on execution...
...

Sry to hear that...
But being curious, why exactly you need this?
With sudo the user still is the same but with more privileges...

funkey7  
I am trying to have a program that controls the gpio. I have it running with root privileges. Now I am l looking for a way to run it as normal user...
The suggestions that work with  raspi do not work here. So I am still searching..
The  banana seems to have strikter security concepts inside. But sooner later..

You have to log in before you can reply Login | Sign Up

Points Rules