關閉selinux功能


關閉SELinux功能

1.永久關閉

1.1檢查、備份

永久關閉selinux 

1.操作前備份
  cat /etc/selinux/config 

# 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=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 
  cp /etc/selinux/config /etc/selinux/config.bak
  ls -l /etc/selinux/config*
-rw-r--r--. 1 root root 458 Jul 14 11:02 /etc/selinux/config
-rw-r--r--. 1 root root 458 Jul 15 02:08 /etc/selinux/config.bak

 

2.sed修改,看看結果,不加-i

This file controls the state of SELinux on the system.
SELINUX= can take one of these three values:
enforcing - selinux 已經啓動 已經開啓 
permissive  selinux 臨時停用 會顯示警告
disabled -  selinux 徹底關閉 不再運行
SELINUX=enforcing 修改爲 disabled

 

3. 修改selinux配置

  cat /etc/selinux/config

 

This file controls the state of SELinux onthe system.

SELINUX= can take one of these threevalues:

   enforcing - SELinux security policy is enforced.

   permissive - SELinux prints warnings instead of enforcing.

    disabled - No SELinux policy is loaded.

SELINUX=disabled

SELINUXTYPE= can take one of these twovalues:

  cat /etc/selinux/config

This file controls the state of SELinux onthe system.

SELINUX= can take one of these threevalues:

    enforcing - SELinux security policy is enforced.

    permissive - SELinux prints warnings instead of enforcing.

    disabled - No SELinux policy is loaded.

SELINUX=disabled

SELINUXTYPE= can take one of these twovalues:

 

4.臨時關閉SELinux

臨時關閉selinux

1.查看selinux狀態
  getenforce 
Enforcing

2.關閉selinux
  setenforce 
usage:  setenforce [ Enforcing | Permissive | 1 | 0 ]
  setenforce 0
  getenforce 
Permissive
 3.重啓服務器之後失效


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