SELinux audit2allow命令使用

解决方案:

首先将我们的报错avc日志拷出来做成一个avc.txt放在Ubuntu系统下面在终端中运行以下命令生成的avc.te文件就是我们的解决方法了。

audit2allow –i avc.txt >avc.te

avc.txt

avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0
avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0
avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0
avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0
avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0
avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0
avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0
avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0
avc: denied { create } for name="hsdi_tmp" scontext=u:r:system_app:s0 tcontext=u:object_r:protect_f_data_file:s0 tclass=dir permissive=0

运行audit2allow工具(external/selinux/prebuilts/bin/audit2allow)之后得到的avc.te文件

avc.te

#============= system_app ==============
allow system_app protect_f_data_file:dir create;

前面的#============= system_app ==============

就是在告诉你在那个文件里面,你可以找到你们系统真正起作用的system_app.te文件是那个目录的。然后在文件的末尾处添加里面的那句话

allow system_app protect_f_data_file:dir create;

注意 这个权限问题是要一个个慢慢来的,也就是说你这个权限加了 等会你运行进去还有可能出现其他的权限问题。这就需要大家要有耐心慢慢的去一个个加好。

有的时候权限明明加进去了却还是报相同的错误 这个时候你就得检查你是否加对地方了。

把你编译的这个文件拷贝出来

out/target/product/angler/obj/ETC/sepolicy.recovery_intermediates/policy_recovery.conf

  • 5
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值