selinux权限问题【转】
本文转载自:https://blog.csdn.net/u011386173/article/details/83339770
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011386173/article/details/83339770
adb修改selinux
Enforcing(表示已打开),Permissive(表示已关闭)
getenforce; //获取当前selinux状态
setenforce 1; //打开selinux
setenforce 0; //关闭selinux
从kernel中彻底关闭
修改/linux/android/kernel/arch/arm64/configs/xxx_defconfig文件(xxx一般为产品名),去掉CONFIG_SECURITY_SELINUX = y的设置项
sepolicy中添加权限
修改依据,通过指令cat /proc/kmsg | grep denied,或Kernel 的log中定位到的标志性log
修改步骤
找相应的源类型.te文件,此文件可能存放的路径:
linux/android/external/sepolicy
linux/android/device/qcom/sepolicy/common
device/xxx/sepolicy(与device相关)
标志性log
avc: denied { 操作权限 } for pid=7201 comm=“进程名” scontext=u:r:源类型:s0 tcontext=u:r:目标类型:s0 tclass=访问类型 permissive=0
·在相应源类型.te文件,添加如下格式的一行语句(结尾有分号)
格式:allow 源类型 目标类型:访问类型 {操作权限};
实例
kernel log:
avc: denied {getattr read} for pid=7201 comm="xxx.xxx" scontext=u:r:system_app:s0 tcontext=u:r:shell_data_file:s0 tclass=dir permissive=0
修改方案:
在system_app.te文件中,添加下面语句:
allow system_app shell_data_file:dir{getattr read};
修改Sepolicy后出现“Error While Expanding policy”
在系统添加某个*.te或在te文件中添加某个selinux权限后,build会出现如下error:
genfscon proc /driver/thermal u:object_r:proc_thermal:s0
libsepol.report_failure: neverallow on line 429 of system/sepolicy/private/app.te (or line 21317 of policy.conf) violated by allow system_app system_file:file { write };
libsepol.report_failure: neverallow on line 406 of system/sepolicy/public/domain.te (or line 8484 of policy.conf) violated by allow system_app system_file:file { write };
libsepol.check_assertions: 2 neverallow failures occurred
Error while expanding policy
这是因为在/system/sepolicy/private/app.te和system/sepolicy/public/domain.te文件中添加了一些neverallow rules,导致编译检查的时候出现错误。
neverallow appdomain system_file:dir_file_class_set {create write setattr relabelfrom relabelto append unlink link rename};
只需要在上面的规则中去掉添加的allow xx system_file:file { write };中的xx,具体方式是在nerverallow中用{}里用-xx排除某个,即不需要有此规则:
neverallow {appdomain -system_app} system_file:dir_file_class_set {create write setattr relabelfrom relabelto append unlink link rename};
selinux权限问题【转】的更多相关文章
- apache 访问权限出错,apache selinux 权限问题, (13) Permission Denied
今天在使用 httpd 做文件服务器的时候,发现 png 图像没有打开,但是原本www/html 文件夹内部的文件就可以打开.后来猜测是selinux 的问题,之前一直想写一篇关于selinux 的博 ...
- SELinux 权限设置
SELinux 权限设置 一.SELinux简介 SELinux全称是Security Enhanced Linux,由美国国家安全部(National Security Agency)领导开发的GP ...
- centos 6.4 samba 权限 selinux权限配置
http://www.cnblogs.com/xiaoluo501395377/archive/2013/05/26/3100444.html(参考) SELINUX 策略 配置好samba后, 输入 ...
- Android 系统添加SELinux权限
本文为博主原创文章,转载请注明出处:https://i.cnblogs.com/EditPosts.aspx?postid=11185476 CPU:RK3288 系统:Android 5.1 SEL ...
- 快速解决Android中的selinux权限问题【转】
本文转载自:http://blog.csdn.net/mike8825/article/details/49428417 版权声明:本文为博主原创文章,未经博主允许不得转载. 关于selinux的详细 ...
- Android 6.0出现的init: cannot execve(‘XXX’):Permission denied问题:禁止SELINUX的权限设置
最近在开发MTK的相关项目,需要将一些可执行文件添加到init.rc文件里去,但是开机后发现,这个bin文件没有权限不能执行,于是我就在init.rc中对相应的bin文件增加了权限.后来发现,改了也没 ...
- 库会因为权限问题无法打开——selinux开启严格模式
第三方库会因为提高selinux权限等级而无法打开,若使用setenforce 0可以打开则可确认.需要增加相应权限.修改te权限. 查看SELinux状态: 1./usr/sbin/sestatus ...
- root权限后,不要忘了还有selinux
下面的例子运行在中兴android 5.0手机上. 当我们使用root权限的python去创建socket监听端口8088时,selinux向kmsg输出了下面的记录 python-android5 ...
- CentOS6.5 服务器+apache5.3绑定多个域名+SELinux设置
下面简单的介绍了如何通过设置Apache的http.conf文件,进行多个域名以及其相关的二级域名的绑定(假设我们要绑定的域名是minidx.com和ntt.cc,二级域名是blog.minidx.c ...
随机推荐
- Mysql导出(多张表)表结构及表数据 mysqldump用法
命令行下具体用法如下: mysqldump -u用戶名 -p密码 -d 數據库名 表名 脚本名; 1.导出數據库為dbname的表结构(其中用戶名為root,密码為dbpasswd,生成的脚 ...
- Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
很明显应该是HADOOP_HOME的问题.如果HADOOP_HOME为空,必然fullExeName为null\bin\winutils.exe.解决方法很简单,配置环境变量,不想重启电脑可以在程序里 ...
- jdbc连接oracle时使用的字符串格式
两种方式: SID的方式: jdbc:oracle:thin:@[HOST][:PORT]:SID SERVICE_NAME的方式: jdbc:oracle:thin:@//[HOST][:PORT] ...
- Unity shader学习之逐像素漫反射光照模型
shader如下: Shader "Custom/Diffuse Fragment-Level" { Properties { _Diffuse (,,,) } SubShader ...
- python3(socket 实现udp,tcp套接字编程)
#coding=utf-8 #客户端程序TCP 连接 import socket s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.connec ...
- jQuery事件--change([[data],fn])、on(events,[selector],[data],fn)和hover([over,]out)
change([[data],fn]) 概述 当元素的值发生改变时,会发生 change 事件. 该事件仅适用于文本域(text field),以及 textarea 和 select 元素.当用于 ...
- arm cortex-m0plus源码学习(二)AMBA3.0_ AHBLite
1. AMBA总线概述 AMBA2.0 以上版本都是基于单沿时钟.单向信号线的协议[1]. 现在市场上大部分的基于 AMBA 架构的 SoC 产品, 系统总线采用 AHB, 外部总线采用 APB.系统 ...
- python二叉树的深度遍历之先序遍历流程图
- Fiddler4入门--手机抓包工具安装和使用说明
Fiddler4入门--手机抓包工具安装和使用说明.电脑最好是笔记本连同一个wifi,这样能和手机保持统一局域网内. 很多区块链dapp项目方风控做的很差,利用fiddler抓包分析找一些漏洞,然后利 ...
- 关于spark进行实时日志解析,保存hbase与mysql
进行地域分析 rowkey=中国_上海_201901016 value=访问次数 areaStartAmt.foreachRDD(rdd => { rdd.foreachPartition(pa ...