Having to be root to diddle with the i/o pins seems questionable to me from a unix security standpoint.
Repeating my response to a similar question: This is perhaps a more long-winded reply than you might want but in the general case I'm wondering why the BBB is shipped with the device nodes in /dev for LEDs, and any other i/o stuff, set to be owned and writable only by root. It seems to me that it would be nicer if there was a unix group that had write permission to the device nodes and a udev rule that set up the devices to have write permission by that group. Different devices could have different groups if you want to keep things narrowed down. http://www.linux.com/news/hardware/peripherals/180950-udev Then just add your account and any others to that group that need write access. (And read access as well for the devices that are readable.) On Friday, February 7, 2014 1:28:22 PM UTC-8, Jake Swensen wrote: > > OS Image: Ubuntu Precise 12.04.3 LTS > > I'm attempting to control LEDs from a webpage (and eventually other > hardware from the device tree overlay). I've written a C program to toggle > the onboard LED based on the arguments passed to it. This only works if you > run it as root however. I've also installed lighttpd and have a php page > running with a link to toggle the LED based on button press. To work > around running as root, I added a setuid(0) to the C program and changed > the ownership of the gcc output binary to root, then made the binary > readable and executable by any user. The result is that the php page can > control the LED, but I'm uncertain of how safe this set up is. > > Is there a better (safer) way for me to be controlling hardware from a > webpage with C? If not, what are my other options? > > Let me know if I can provide you with any additional details. > > Thanks, > Jake > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
