permission denied to pins unless root

1,613 views
Skip to first unread message

sam.oute...@gmail.com

unread,
Sep 26, 2013, 4:23:11 AM9/26/13
to beagl...@googlegroups.com

I'm trying to run a simple led blink example like here:

http://www.phys-x.org/rbots/index.php?option=com_content&view=article&id=104:lesson-1-beaglebone-black-blink-led&catid=46:beaglebone-black&Itemid=81

I'm running a Ubuntu image on my beaglebone black with node 0.8.x.  I get a permission problem that looks like some form of failure to have access to the pins.  I added my user to the dialout group and that didn't work.  Then I added my user to every group I could find and that didn't work either.  The only way I can get the code to run and do the blinking is if I run it as root.  My question is, how do I give my user access to whatever is needed to reach the pins running as non-root.  The permission problem looks like the following:

fs.js:338
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: EACCES, permission denied '/sys/class/leds/beaglebone:green:usr0/trigger'
    at Object.fs.openSync (fs.js:338:18)
    at Object.fs.writeFileSync (fs.js:756:15)
    at Object.f.pinMode (/home/ubuntu/projects/hello_express/node_modules/bonescript/index.js:132:20)
    at Object.<anonymous> (/home/ubuntu/projects/hello_express/hello_express.js:31:3)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)

Thanks for any help in advance.  I'm pretty excited to get this running.

- Samuel

dorian....@gmail.com

unread,
Jan 27, 2014, 5:19:29 AM1/27/14
to beagl...@googlegroups.com, sam.oute...@gmail.com
I'm stuck at the same problem with the same setup right now. Did you get it running?

tim....@gmail.com

unread,
May 21, 2014, 12:29:19 AM5/21/14
to beagl...@googlegroups.com, sam.oute...@gmail.com
Try this solution:  It worked for me!


"I have not played with the GPIO pins this way but based on lgeorgets second comment and this article, you must first set the direction of the pin to "out". The direction node is owned by root, so:
sudo sh -c 'echo out > /sys/class/gpio/gpio18/direction'

sh -c is needed here to execute that command in a root subshell. This is because sudo echo out > direction would execute echo as root, but the redirection (> direction) would be done by your current (non-root) shell. You could also just do this su root.

After that you should, hopefully, be able to set value as cameron."

Oscar Castiblanco

unread,
May 26, 2014, 10:36:06 AM5/26/14
to beagl...@googlegroups.com, sam.oute...@gmail.com
If you are using debian, you can modify the file /etc/rc.local

and add this instruction:

find /sys/class/beaglebone:green:usr0/ -type f -exec chmod 777 {} \;

then restart the board. This script runs after booting.
Reply all
Reply to author
Forward
0 new messages