0

I’m trying to change pin mode on RPI (with Raspbian) – it works when I invoke those commands

sudo chown root.gpio /dev/gpiomem
sudo chmod g+rw /dev/gpiomem

but after every restart I have to execute them because without this I have this error:

“Setting a mode to a pin requires root permissions. ---> System.UnauthorizedAccessException: Access to the path '/sys/class/gpio/gpio21/direction' is denied. ---> System.IO.IOException: Permission denied”

How can I persist those permissions?

Ingo
  • 42,107
  • 20
  • 85
  • 197
dnf
  • 101
  • 1
  • What operating system? – joan Jan 03 '19 at 21:42
  • Raspbian (November 2018) – dnf Jan 03 '19 at 22:13
  • 1
    You should edit useful information into your question. People shouldn't need to read the comments. You should just add your user to group gpio. Nothing else should be required on Raspbian, i.e. a one off sudo adduser pi gpio. – joan Jan 03 '19 at 22:57
  • I updated my question when I commented post and pi user is already in this group – dnf Jan 03 '19 at 23:00

0 Answers0