首页 > 系统服务 > 详细

关闭selinux功能

时间:2017-08-08 19:31:00      阅读:221      评论:0      收藏:0      [点我收藏+]


关闭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功能

原文:http://heyong.blog.51cto.com/13121269/1954573

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!