文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > Linux的capability深入分析
侵权投诉

Linux的capability深入分析

4 #include <sys/types.h>

5 #include <unistd.h>

6 #include <linux/capability.h>

7 #include <errno.h>

8

9 int main()

10 {

11 struct __user_cap_header_struct cap_header_data;

12 cap_user_header_t cap_header = &cap_header_data;

13

14 struct __user_cap_data_struct cap_data_data;

15 cap_user_data_t cap_data = &cap_data_data;

16

17 cap_header->pid = getpid();

18 cap_header->version = _LINUX_CAPABILITY_VERSION_1;

19

20 if (capget(cap_header, cap_data) < 0) {

21 perror("Failed capget");

22 exit(1);

23 }

24 printf("Cap data 0x%x, 0x%x, 0x%x\n", cap_data->effective,

25 cap_data->permitted, cap_data->inheritable);

26 }

gcc capget0.c -o capget0 -lcap

普通用户:

./capget0

Cap data 0x0, 0x0, 0x0

超级用户:

/home/test/capget0

Cap data 0xffffffff, 0xffffffff, 0x0

这也说明了默认情况下,root运行的进程是什么权限都有,而普通用户则什么权限都没有. 我们可以将本程序与上面的程序进行整合,如下:

1 #include <stdio.h>

2 #include <stdlib.h>

3 #include <string.h>

4 #include <sys/types.h>

5 #include <unistd.h>

6

7 #undef _POSIX_SOURCE

8 #include <sys/capability.h>

9

10 extern int errno;

上一页第4页

你可能喜欢

热门文档

相关文档

  • Linux操作系统源代码详细分析

    linux/binfmts.h 146 include/linux/capability.h 147 include/linux/elf.h ...旋转锁将在第 10 章进行深入介绍。 如果你对 flags 在传送给 spin_lock_...

  • linuxkernelana

    linux/binfmts.h 146 include/linux/capability.h 147 include/linux/elf.h ...内核体系结构的深入了解 442 3.4 Linux 内核的类型 444 3.5 设计和实现的...

  • linux内核分析

    下面,在具体深入 linux 内核分析研究之前,需要 对内核中进程相关的几个概念做...具体的实现:Processors typically provide this capability with a mode bit in ...

  • LINUX开发入门

    (HHARM9-EDU实验6中断、 14GPIO/key、AD/DA、I2C等) 进一步深入学习其它的...<linux/major.h> #include <linux/blkdev.h> #include <linux/capability.h...

  • Linux可抢占内核的分析

    capability of Linux.Based on the SMP support of Linux,the kernel of Linux...随着对中间件研究的深入,相关的技 术会越来越多,所设计的中间件产品性能会更好...

  • Linux启动过程分析

    .c 功能:initializes some of the processor’s interrupt handling capability. ...2005-12-30 28 内容 Linux启动函数分析 X86下的Linux启动分析 ARM下的Linux...

  • 基于Linux实时调度策略的优化

    amongallthemethodsofimprovingLinuxrealtimecapability,theprimarywayincludesthinning...本课题针对Linux实时调度策略单一性限帛lJLinux实时应用的情况,深入研 究和分析...

  • Linux下的Capabilities安全机制分析

    Linux下的Capabilities安全机制分析_IT/计算机_专业资料。Linux下的Capabilities...即将 r00t的特权分割成不同的capabIlIty(本文译为权能),每种 权能代表一定的...

  • Embedded Linux OS的实时性研究

    (2008)03—0109—04 ResearchofReaI—TimeCapabilityofEmbeddedLinux0SZHANGZi—qiang...开发难度等方面对两者进行一些深入 的对比,以及分析:3.1实时性能 合前面提到的...

  • Linux操作系统源代码详细分析

    capability.h 147 /linux/elf.h 150 /linux/elfcore.h 156 /linux/errupt.h...(spin-lock)来控制对控制台访问旋转锁将在第10章进行深入介绍 如果你对 flags...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email