首页 > 代码库 > selinux
selinux
最近公司打算用上selinux,如是研究了下selinux
selinux启动会改每个资源赋予5种属性:
5种属性(rhel 3种有效):
ls -Z
用户名
角色
类型
[root@centos html]# pwd
/var/www/html
[root@centos html]# ls -lZ index.html
-rw-r--r--. tt root unconfined_u:object_r:httpd_sys_content_t:s0 index.html
更改:
chcon
-t 指定类型
-R 递归
--reference=TYPE 以rfile标签为参照
撤销:
restorecon
eg:
chcon -R --reference=/var/www/html /web/
restorecon -R /web/
如果要让普通用户可以写root创建的文件:
1、更改目录及文件的所属主
chown -R haha.root /scr/
2、更改selinux属性类型为:
unconfined_t 或 user_home_t
selinux布尔型机制:
getsebool -a
#查看系统写好的selinux二进制规则
selinux
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。