I want to give node.js the ability to listen on port 80, and shutdown the computer. Initially I tried these two commands in sequence:

setcap cap_net_bind_service=+ep /usr/bin/nodejs
setcap cap_sys_boot=+ep /usr/bin/nodejs

Then my app was failing to bind to port 80. I checked with getcap:

# getcap /usr/bin/nodejs
/usr/bin/nodejs = cap_sys_boot+ep

If I run setcap again for cap_net_bind_service:

# getcap /usr/bin/nodejs
/usr/bin/nodejs = cap_net_bind_service+ep

I don't see anything in the man page http://linux.die.net/man/8/setcap about setting multiple capabilities, and try some things in desperation:

# setcap cap_net_bind_service=+ep /usr/bin/nodejs cap_sys_boot=+ep /usr/bin/nodejs
# getcap /usr/bin/nodejs
/usr/bin/nodejs = cap_sys_boot+ep
# setcap cap_net_bind_service=+ep cap_sys_boot=+ep /usr/bin/nodejs
Failed to set capabilities on file `cap_sys_boot=+ep' (No such file or directory)

How do I set multiple capabilities?­­­­­­­


And one last desperate syntax guess pays off:

# setcap cap_net_bind_service,cap_sys_boot=+ep /usr/bin/nodejs
# getcap /usr/bin/nodejs
/usr/bin/nodejs = cap_net_bind_service,cap_sys_boot+ep
  • please tick. You have the correct answer. Apr 16 '15 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.