setcap cap_linux_immutable=eip /usr/bin/chattr
切换到普通用户:
su - test
chattr +i /tmp/test
lsattr /tmp/test
----i-------------- /tmp/test
我们看到授权成功了,注意,这里只能对自己的文件授权(immutable/append-only)权限,对于其它用户的权限LINUX_IMMUTABLE不起作用(root除外),如下:
su - test
chattr +i /etc/passwd
chattr: Permission denied while setting flags on /etc/passwd
十五)CAP_NET_BIND_SERVICE 10(允许绑定到小于1024的端口)
普通用户不能通过bind函数绑定小于1024的端口,而root用户可以做到,CAP_NET_BIND_SERVICE的作用就是让普通用户也可以绑端口到1024以下.
普通用户通过nc绑定端口500,如下:
nc -l -p 500
Can't grab 0.0.0.0:500 with bind : Permission denied
增加CAP_NET_BIND_SERVICE能力到nc程序,如下:
setcap cap_net_bind_service=eip /usr/bin/nc
再切换到普通用户,通过nc绑定端口500,如下:
nc -l -p 500
查看该端口:
netstat -tulnp|grep nc
tcp 0 0 0.0.0.0:500 0.0.0.0:* LISTEN 2523/nc
十六)CAP_NET_BROADCAST 11(允许网络广播和多播访问)
事实上它并没有被应用,普通用户也可以使用ping -b 192.168.0.255也发送广播包
十七)CAP_NET_ADMIN 12(允许执行网络管理任务:接口,防火墙和路由等)
普通用户不能创建新的网络接口(interface),不能更改ip地址,而CAP_NET_ADMIN可以帮助普通用户完成这项工作,如下:
用普通用户创建新的网卡接口eth0:1失败
/sbin/ifconfig eth0:1 172.16.27.133 netmask 255.255.255.0
SIOCSIFADDR: Permission denied
SIOCSIFFLAGS: Permission denied
SIOCSIFNETMASK: Permission denied
此时我们把CAP_NET_ADMIN能力授权给ifconfig程序,如下:
setcap cap_net_admin=eip /sbin/ifconfig
我们再次用普通用户即可以新建网络接口eth0:1,并可以DOWN掉接口,如下:
/sbin/ifconfig eth0:1 172.16.27.133 netmask 255.255.255.0
/sbin/ifconfig eth0:1
eth0:1 Link encap:Ethernet HWaddr 00:0c:29:f9:5e:06
inet addr:172.16.27.133 Bcast:172.16.27.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:18 Base address:0x1080
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...
热门文档