OSMC run add-on as root

It’s a very old post and I’m not sure exactly what you want to do. @sam_nazarko hasn’t yet responded, so I’m unsure what the current state of play is.

I doubt you need access to /dev/mem but if you want read access to /dev/gpiomen, create a file /etc/udev/rules.d/01-gpio-permissions.rules and paste this line into it:

KERNEL=="gpiomem", SUBSYSTEM=="bcm2835-gpiomem", MODE="0640", GROUP="osmc"

then reboot. Afterwards, /dev/gpiomem will have the following permissions and ownership:

crw-r----- 1 root osmc 244, 0 May 17 12:45 /dev/gpiomem

If you add group osmc to user www-data, your web page should now have read access.