什么能力可以打开/proc/pid/ns/net?

问题描述

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.

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...