Forum | Documentation | Website | Blog

Skip to content

Allow the use of the library w/out root, using capabilities instead

Jason Kridner requested to merge github/fork/ycdtosa/pr_use_capabilities into master

Created by: ycdtosa

Currently libroboticscape does not allow running rc_initialize unless user is root.

This PR will allow rc_initialize to succeed when user is not root but the process has the required capabilities.

As far as I was able to narrow those, the required capabilities are CAP_SYS_RAWIO and CAP_DAC_OVERRIDE.

Programers using the library might want to drop capabilities at some point.

To give the required capabilities to a binary you SHOULD use setcap.

   sudo apt-get install libcap2-bin          #install setcap et al
   sudo setcap cap_sys_rawio,cap_dac_override+epi /path/to/your/binary

This introduces a dependency with libcap2 on runtime. This introduces a dependency with libcap-dev on build-time.

Merge request reports