博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Selinux 配置
阅读量:3956 次
发布时间:2019-05-24

本文共 965 字,大约阅读时间需要 3 分钟。

SOC: Rk3399, Platform: Android 8.0.

一: 文件不可写,未获取到write属性。

在打印错误log中获取主要信息 denied -->需要获取的权限,name-->需要获取权限的文件,scontext-->需要配置的文件,tcontext-->文件所在路径,tclass-->文件类型。

type=1400 audit(0.0:49): avc: denied { write } for name="dwc3_mode" dev="sysfs" ino=20703 scontext=u:r:system_app:s0 tcontext=u:object_r:sysfs_usb0:s0 tclass=file permissive=0

  • 分析
    • 缺少的权限:{write/read}
    • 谁缺少权限:scontext=u:r:system_app:s0
    • 哪个文件的权限:tcontext=u:object_r:sysfs_usb0:s0
    • 文件的类型:tclass=file
  • 解决
    • allow system_app sysfs_usb0:file {open read write };
    • 公式:allow + scontext + tcontext + “:” + file + permission

 

SELinux 的三种模式:

  • enforcing:强制模式,代表 SELinux 运作中,且已经正确的开始限制 domain/type 了;
  • permissive:宽容模式:代表 SELinux 运作中,不过仅会有警告讯息并不会实际限制 domain/type 的存取。这种模式可以运来作为 SELinux 的 debug 之用;
  • disabled:关闭,SELinux 并没有实际运作。

模式切换

1)getenforce

得到当前的SELinux

[root@python bin]# getenforce

Permissive

2)setenforce

更改当前的SELINUX值 ,后面可以跟 enforcing,permissive 或者 1, 0。

[root@python bin]# setenforce permissive

3)sestatus

显示当前的 SELinux的信息

转载地址:http://txxzi.baihongyu.com/

你可能感兴趣的文章
求解方程
查看>>
太弱了。。水题
查看>>
位运算(含应用)
查看>>
野指针与空指针
查看>>
图文混排效果
查看>>
urllib2.urlopen超时问题
查看>>
Choosing a Machine Learning Classifier
查看>>
魏兴国:深入浅出DDoS攻击防御
查看>>
使连续的参考文献能够中间用破折号连起来
查看>>
Discover Feature Engineering, How to Engineer Features and How to Get Good at It
查看>>
36辆车,6条跑道,无计时器,最少几次比赛可以选出前三
查看>>
matlab2012b与matlab7.1执行set(gca,'Yscale','log')之后画到的直方图结果居然不同
查看>>
python读大文件
查看>>
python 3里没有cmp这个函数了
查看>>
回文题
查看>>
二叉树的最短根到叶路径中点的个数
查看>>
给定二叉树求最小深度
查看>>
平衡树
查看>>
栈的应用题(1)
查看>>
判断链表是否有环
查看>>