天天看點

linux之 SELinux保護getenforcesetenforce 0

selinux 是由美國NSA國家安全局提供的一套基于核心的增強的強制安全保護機制,針對使用者,程序,文檔标記安全屬性并實作保護性機制。

SELinux安全體系直接內建在Linux核心中,包括三種運作模式:

disabled:徹底禁用,核心在啟動時不加載SELinux安全體系

enforcing: 強制啟用,核心加載SELinux安全體系,并強制執行保護政策

permissive:寬松模式,核心加載 SELinux安全體系,隻記錄不執行

檢視目前模式:

# getenforce            

Disabled //表示目前為徹底禁用模式

enforcing //表示強制啟用模式

permissive //寬松模式

檢視目前模式

getenforce

Enforcing

臨時切換寬松模式

setenforce 0

[root@hello ~]# getenforce

Permissive

永久設定selinux需要修改配置檔案 /etc/selinux/config

[root@server0 ~]# vim /etc/selinux/config

SELINUX=enforcing

.. ..

2)重新開機驗證結果

[root@server0 ~]# reboot

.. ..

[root@server0 ~]# getenforce

繼續閱讀