Any lazy way to put your own local ros package under /opt/ros?
Hello everyone,
I have modified package for a real robot which requires access of the ports bellow 1024.
When I put my catkin_ws under the root, it is able to access the ports below 1024 to communicate with the real robots easily but when I put it under /home/user/catkin_ws it fails to access the port below 1024 even after giving the access rights to the built node binary file.
I am not sure if this is possible or not,
But I am looking to do something similar that happens when we do sudo apt install ros-noetic-pkg-name
but locally. Is there any (lazy) way such that I can redirect the build of the package to the /opt/ros/noetic
. May be with running some script? Or may be something else?
Thanks!
What do you mean by "When I put my catkin_ws under the root"?
You have made a mistake somewhere, because under linux, installing a ros package in /opt/ros/ does not give it permission to create a socket with a port number less than 1024.
Perhaps the implication is that "putting it under the root" would require actual super user privileges. And if those privileges are then also used to start the binary, you'd essentially run that binary as
root
.I am not sure if it gives the access to the ports under 1024 or not. may be because I am running it after
sudo su
is giving access rights. I trid to run the rosnode withsudo
using launch prefix but it didn't helped. I also tried the suggested way of usingsetcap
but it didn't went well. I also triedauthbind
and also to set the unprivileged port number start to zero. Nothing worked for me so far. Any other suggested way to do it?I couldn't find any way so i tried running it under
sudo su
and putting it under/opt/catkin_ws
and it worked.sudo su
essentially starts a shell as theroot
user. So, yes, that would allow your application to open up ports in the system reserved range.Yes, I think I will have to continue with that, Although not a good practice.