问题描述
setcap cap_net_raw,cap_net_admin,cap_sys_admin,cap_dac_override,cap_dac_read_search,cap_fowner+eip
我想要一个普通用户运行的进程,切换到另一个进程的netns,另一个进程由root用户运行。我需要做的是打开/proc/pid/ns/net
,然后调用setns
。
如上所述,我为可执行文件提供了许多功能,但它仍然显示 Permission denied
。有什么想法吗?
解决方法
https://man7.org/linux/man-pages/man2/setns.2.html 建议:
Network,IPC,time,and UTS namespaces
In order to reassociate itself with a new network,or UTS namespace,the caller must have the
CAP_SYS_ADMIN capability both in its own user namespace
and in the user namespace that owns the target namespace.