1. 程式人生 > >關閉selinux功能

關閉selinux功能

關閉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.重啟服務器之後失效


本文出自 “heyong” 博客,請務必保留此出處http://heyong.blog.51cto.com/13121269/1954573

關閉selinux功能