Search code examples
rpc

"Unable to register(....) " error in rpc when running without sudo


I have written a simple "rpc" program. Generated all the files with rpcgen -a -C abc.x But when I am trying to run abc_server I am getting unable to register(PROG,PROG1,udp)... PROG is program name and PROG! is version.

How can i run it without sudo?


Solution

  • Perhaps the issue is that generally a program that is not running as root may not bind to ports numbered less than 1024. If that's the case, then solutions may include

    • using port numbers higher than 1024
    • on Linux, you can allow a specific binary to open such privileged ports:

      setcap 'cap_net_bind_service=+ep' <path-to-binary>