ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Is it possible to publish/subscribe as root?

asked 2016-07-08 12:23:56 -0500

wmrifenb gravatar image

Hello smart people,

I have made a ROS node that makes use of an FTDI library that requires that I run the executable as root to have access to the usb device that the node reads data from. The trouble with running the executable as a super user is that it prevents me from being able to see the roscore master because root uses a different environment and I can't seem to export the ROS master URI location to root's environment variables. Has anyone figured out how to publish/subscribe to rostopics when running a node as a super user?

P.S. Changing permissions on the usb device is not something I think I can do to solve this because FTDI's instructions for use of this library is that I remove the modules that would have the device show up in the /dev/ folder (i.e. rmmod ftdi_sio & rmmod usbserial)

Thanks for the help!

edit retag flag offensive close merge delete


If that's an option, just source the ROS installation and workspaces (as superuser), so that the environment variables will be set. The easiest way would be to actually login as superuser (e.g. sudo su in Ubuntu) and then source the normal user's .bashrc (if it's set up with ROS stuff)

spmaniato gravatar image spmaniato  ( 2016-07-08 15:49:47 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-07-08 12:40:20 -0500

dornhege gravatar image

Yes, that should work.

However, setting the permissions is the better way. udev should work, or just adding yourself to the dialout group.

edit flag offensive delete link more


This doesn't really answer my question. Adding myself to the dialout group wont work because the device is removed from the /dev/ folder upon removal of the modules I mentioned. What I really want to know is how to get a node that is running under root to talk to the ros master

wmrifenb gravatar image wmrifenb  ( 2016-07-08 14:46:03 -0500 )edit

There shouldn't be any difference. Just treat root as another ros user.

dornhege gravatar image dornhege  ( 2016-07-11 10:28:20 -0500 )edit

Question Tools

1 follower


Asked: 2016-07-08 12:23:56 -0500

Seen: 265 times

Last updated: Jul 08 '16