Linux关闭Selinux以及简单操作

                                 Linux Selinux 简单操作

 

         Selinux 是linux中的安(霸)全(道)系统 ,它由NSA编写并设计成内核模块包含到内核中,相应的某些安全相关的应用也被打了SELinux的补丁,最后还有一个相应的安全策略。任何程序对其资源享有完全的控制权。假设某个程序打算把含有潜在重要信息的文件扔到/tmp目录下,那么在DAC情况下没人能阻止他。SELinux提供了比传统的UNIX权限更好的访问控制

平常如果需要简单操作

chcon -t xxxx 命令

简单操作

1.状态查看命令  :getenforce

#查看selinux 状态
[root@localhost /]# getenforce
Enforcing

该命令有三种状态结果

Enforcing     (1)            强制模式         ---安全级别最高,相对的操作权限更低

Permissive   (0)           自由模式          ---安全级别较低,操作权限稍高

Disabled                            关闭模式         ---永久关闭模式,安全级别没有,操作权限最高

2.开启自由模式/临时关闭:setenforce 0 (其实就相当于将状态改为上面的Permissive 模式)

[root@localhost /]# setenforce 0

3.切换为强制模式:setenforce 1  (将状态切回到Enforcing模式)

[root@localhost /]# setenforce 1

4.永久关闭Selinux

     修改/etc/sysconfig/selinux 文件中的配置并且重启服务器

[root@localhost /]# vi /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled    #将这里的enforcing 改为 disabled 
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章