0

I'm writing a C++ program using Opencv and Boost libraries. Until now, I was using Kate and was executing my program using the Terminal with root privileges.

I decided to move to eclipse, but ran into problems executing the program since it needs root privileges which cannot be given using eclipse.
I noticed that in order to use

boost::asio::ip::udp::socket _socket(io_service, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 13));

a program needs root privileges.

Can I somehow use udp sockets without having to give the program root privileges?

Any help would be appreciated.

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
Eliran Koren
  • 187
  • 2
  • 10
  • "I noticed" how are we supposed to help with that? This behavior could be some peculiar configuration quirk or specific to your build or target operating system or implementation of libraries thereon. All we have is the vague idea that you "noticed" *something* and have drawn a conclusion from it. Infact, it isn't UDP sockets that need root privileges, it's SOCK_RAW sockets that need root privileges. http://stackoverflow.com/questions/4404860/raw-sockets-need-root-priviliege and http://sock-raw.org/papers/sock_raw – kfsone Feb 27 '14 at 20:35
  • help: NEVER really NEVER use programs with root privileges. just don't do it. – user1810087 Feb 27 '14 at 20:45
  • possible duplicate of [Is there a way for non-root processes to bind to "privileged" ports (<1024) on Linux?](http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l) – Mad Physicist Feb 27 '14 at 21:04

1 Answers1

2

Using ports below 1024 requires root privileges.

I was using a privileged port(13).

Eliran Koren
  • 187
  • 2
  • 10
  • http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l – user1810087 Feb 27 '14 at 20:55