[ros-users] Nodes with root privileges

Taylor Veltrop taylor at veltrop.com
Fri Mar 26 04:10:23 UTC 2010


Under Linux (Debian Lenny) I am having issues running an ROS node with
superuser (root) privileges.

I must have superuser privileges on this node becuase the library for
the Roboard (www.roboard.com) requires it for hardware access. That
library uses #include <sys/io.h>.

So what I have done is after building the node a script will chown
root:root the node, and chmod +s the node.  The node functions
properly and as expected when it accesses the hardware, until I start
using callbacks for messages.  If calls are made to <sys/io.h> from
within a message callback the program segfaults, but if calls are made
to <sys/io.h> elsewhere in the program there are no problems.

I would like to run privileged code from within the callbacks, how can
I do this?  Are the callbacks being executed from a separate thread
which does not have privileges?  What am I missing here?

Or is there a better, different method to run a node with root privileges?


The pr2_etherCAT (http://www.ros.org/wiki/pr2_etherCAT) node uses root
privelges.  A program called pr2_grant runs the chmod command similar
to what I did.  But pr2_etherCAT does not subscribe to any topics, nor
does it include <sys/io.h> so I couldn't get more help there.


Thank you,
Taylor Veltrop
http://taylor.veltrop.com



More information about the ros-users mailing list