chmod 6777 /tmp/passwd
ls -l /tmp/passwd
-rwsrwsrwx 1 test test 14 2011-04-30 14:25 /tmp/passwd
切换到root用户,给/tmp/fsetid程序授权CAP_FSETID能力,如下:
setcap cap_fsetid=eip /tmp/fsetid
切换到普通用户
/tmp/fsetid
Wrote 14 bytes to the file.
ls -l /tmp/passwd
-rwsrwsrwx 1 test test 14 2011-04-30 14:28 /tmp/passwd
十)CAP_KILL 5 (允许对不属于自己的进程发送信号)
我们先模拟没有加CAP_KILL能力的情况,如下:
终端1,用root用户启用top程序,如下:
su - root
top
终端2,用test用户kill之前的top进程,如下:
pgrep top
3114
/bin/kill 3114
kill: Operation not permitted
我们发现无法对不属于自己的进程发送信号.
下面我们用CAP_KILL能力的程序向不属于自己的进程发送信号,如下:
设定kill命令的kill位,如下:
setcap cap_kill=eip /bin/kill
杀掉3114进程,没有问题,如下:
/bin/kill 3114
echo $?
注意:
普通用户要用/bin/kill这种绝对路径的方式,而不能用kill这种方式.
十一)CAP_SETGID 6 (设定程序允许普通用户使用setgid函数,这与文件的setgid权限位无关) cp /etc/shadow /tmp/
chown root.root /tmp/shadow
chmod 640 /tmp/shadow
切换到普通用户test,并编写setgid测试程序,如下:
su - test
1 #include <unistd.h>
2 int
3 main ()
4 {
5 gid_t gid = 0;
6 setgid(gid);
7 system("/bin/cat /tmp/shadow");
linux/binfmts.h 146 include/linux/capability.h 147 include/linux/elf.h ...旋转锁将在第 10 章进行深入介绍。 如果你对 flags 在传送给 spin_lock_...
linux/binfmts.h 146 include/linux/capability.h 147 include/linux/elf.h ...内核体系结构的深入了解 442 3.4 Linux 内核的类型 444 3.5 设计和实现的...
下面,在具体深入 linux 内核分析研究之前,需要 对内核中进程相关的几个概念做...具体的实现:Processors typically provide this capability with a mode bit in ...
(HHARM9-EDU实验6中断、 14GPIO/key、AD/DA、I2C等) 进一步深入学习其它的...<linux/major.h> #include <linux/blkdev.h> #include <linux/capability.h...
capability of Linux.Based on the SMP support of Linux,the kernel of Linux...随着对中间件研究的深入,相关的技 术会越来越多,所设计的中间件产品性能会更好...
.c 功能:initializes some of the processor’s interrupt handling capability. ...2005-12-30 28 内容 Linux启动函数分析 X86下的Linux启动分析 ARM下的Linux...
amongallthemethodsofimprovingLinuxrealtimecapability,theprimarywayincludesthinning...本课题针对Linux实时调度策略单一性限帛lJLinux实时应用的情况,深入研 究和分析...
Linux下的Capabilities安全机制分析_IT/计算机_专业资料。Linux下的Capabilities...即将 r00t的特权分割成不同的capabIlIty(本文译为权能),每种 权能代表一定的...
(2008)03—0109—04 ResearchofReaI—TimeCapabilityofEmbeddedLinux0SZHANGZi—qiang...开发难度等方面对两者进行一些深入 的对比,以及分析:3.1实时性能 合前面提到的...
capability.h 147 /linux/elf.h 150 /linux/elfcore.h 156 /linux/errupt.h...(spin-lock)来控制对控制台访问旋转锁将在第10章进行深入介绍 如果你对 flags...
热门文档