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

 

 

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