栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Linux capability (二):APIs

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Linux capability (二):APIs

1. prctl   (SET AMBIENT and bounding set)

 #include 

       int prctl(int option, unsigned long arg2, unsigned long arg3,
                 unsigned long arg4, unsigned long arg5);

PR_CAP_AMBIENT (since Linux 4.3)
              Reads or changes the ambient capability set of the calling thread, according     
              to the  value  of  arg2,  which must be one of the following:


PR_CAPBSET_DROp (since Linux 2.6.25)
     If the calling thread has the CAP_SETPCAP capability within its user namespace,  
   then drop  the  capability specified  by  arg2  from  the calling thread's capability 
   bounding set.  Any children of the calling thread will inherit the newly reduced 
   bounding set.


cap_set_drop(int capvalue)
    prctl(PR_CAPBSET_DROP, capvalue, 0, 0, 0);
    

            

2. SET keep flag

PR_SET_KEEPCAPS (since Linux 2.2.18)
              Set the state of the calling thread's "keep capabilities" flag.  The effect of this flag is described in capabilities(7).   arg2  must be either 0 (clear the flag) or 1 (set the flag).  The "keep capabilities" value will be reset to 0 on subsequent calls to execve(2).
 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/289894.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号