Accessing /sys as a non-root user
-
I've been trying to access my led as a non-root user. I get the error:
IOError: [Errno 13] Permission denied: '/sys/class/leds/omega2p:amber:system/trigger'
chmod'ing the appropriate directory (as root) makes it work, but it doesn't persist.
I tried creating a /etc/local.d with the chmod in it but that didn't work.
Is there any persistent way of configuring sysfs?
-
@Ted-Wood you might get it to work if you move the filesystem to the /overlay as in,
https://docs.onion.io/omega2-docs/boot-from-external-storage.html
-
@Douglas-Kryder said in Accessing /sys as a non-root user:
@Ted-Wood you might get it to work if you move the filesystem to the /overlay as in,
https://docs.onion.io/omega2-docs/boot-from-external-storage.htmlNo. That won't work.
/sys is a virtual file system exported by the kernel
chmod or chown should work if done correctly, but it may need to also be done after the relevant GPIO export - in doing it on boot, it might happen before the thing it would apply to exists.
I tried creating a /etc/local.d with the chmod in it but that didn't work.
That sounds like a confusion - there's /etc/rc.local or various things under /etc/init.d/ but I don't think the specific thing you tried is a valid mechanism
-
I made it work by adding the chmod to the /etc/rc.d/S96led file.
Probably not ideal, but works for now.