Using setcap in linux [closed]

≯℡__Kan透↙ 提交于 2019-12-05 09:52:49

问题


To add the cap_net_raw capability to (for eg /bin/ping), we use the following:

#setcap cap_net_raw=ep /bin/ping

What is the meaning of ep and why is it required here ?


回答1:


This sets the CAP_NET_RAW bit in both the "effective" (e) and "permitted" (p) capability sets. These two sets, along with the "inheritable" set, govern the capabilities that a process has or can set.

See more here:

capabilities - Linux man page

Capability Sets

Each thread has three capability sets containing zero or more of the above capabilities:

Effective - the capabilities used by the kernel to perform permission checks for the thread.

Permitted - the capabilities that the thread may assume (i.e., a limiting superset for the effective and inheritable sets). If a thread drops a capability from its permitted set, it can never re-acquire that capability (unless it exec()s a set-user-ID-root program).

inheritable - the capabilities preserved across an execve(2). A child created via fork(2) inherits copies of its parent's capability sets. See below for a discussion of the treatment of capabilities during exec(). Using capset(2), a thread may manipulate its own capability sets, or, if it has the CAP_SETPCAP capability, those of a thread in another process.



来源:https://stackoverflow.com/questions/7860690/using-setcap-in-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!