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二进制规则
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号