'setcap'覆盖最后的功能。如何设置多种功能?


9

我想让node.js能够侦听端口80并关闭计算机。最初,我依次尝试了以下两个命令:

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

然后我的应用程序无法绑定到端口80。我使用getcap进行了检查:

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

如果我再次为cap_net_bind_service运行setcap:

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

我没有在手册页http://linux.die.net/man/8/setcap中看到任何有关设置多种功能的信息,并尝试了一些绝望的事情:

# 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)

如何设置多种功能?

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.