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

Linux的capability深入分析

1 #include <sys/types.h>

2 #include <sys/types.h>

3 #include <sys/stat.h>

4 #include <fcntl.h>

5 #include <sys/stat.h>

6 #include <stdio.h>

7 #include <stdlib.h>

8 #include <string.h>

9 main()

10 {

11 int handle;

12 char string[40];

13 int length, res;

14

15 if ((handle = open("/tmp/passwd",

O_TRUNC,S_IREAD | S_IWRITE)) == -1)

16 {

17 printf("Error opening file.\n");

18 exit(1);

19 }

20 strcpy(string, "Hello, world!\n");

21 length = strlen(string);

22 if ((res = write(handle, string, length)) != length)

23 {

24 printf("Error writing to the file.\n");

25 exit(1);

26 }

27 printf("Wrote %d bytes to the file.\n", res);

28 close(handle);

29 }

gcc fsetid.c -o fsetid

先测试没有设FSETID的情况,如下:

chmod 6777 /tmp/passwd

ls -l /tmp/passwd

-rwsrwsrwx 1 test test 14 2011-04-30 14:22 /tmp/passwd

/tmp/fsetid

Wrote 14 bytes to the file.

ls -l /tmp/passwd

-rwxrwxrwx 1 test test 14 2011-04-30 14:25 /tmp/passwd

我们看到setuid/setgid位被清除了.

下面是设定FSETID,如下: O_WRONLY | O_CREAT |

上一页第9页

你可能喜欢

热门文档

相关文档

  • 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