一些Linux默认都是启用SeLinux的,在安装操作系统的时候我们可以选择开启或者关闭SeLinux,但是在安装完系统之后又如何开启与关闭呢?
在/etc/sysconf下有一个SeLinux文件,使用vi打开,更改其中的SELINUX项的值就可以了。

  • SELINUX=disable  禁用SeLinux
  • SELINUX=enforcing  使用SeLinux
[root@localhost sysconfig]# vim 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=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

关闭SELinux

1.无须重起而暂时关闭SELinux

  • 以root用户运行以下命令
setenforce 

这条命令的作用是把SELinux暂时设定成Permissive模式(关于Permissive Mode在以下会有介绍)

如果要恢复运行SELinux则可以运行

setenforce 

这条命令会把SELinux设定成Enforcing模式

2.把SELinux永久设定为Permissive模式

这里需要讲一下Permissive和Enforcing模式的区别。 SELinux有三种模式:Enforcing, Permissive and Disable.

Enforcing模式就是应用SELinux所设定的Policy, 所有违反Policy的规则(Rules)都会被SELinux拒绝
Permissive和Enforcing的区别就在于它还是会遵循SELinux的Policy,但是对于违反规则的操作只会予以记录而并不会拒绝操作

Disable 顾名思义就是完全禁用SELinux

如果要永久设定为Permissive模式,我们就要修改SELinux的配置文件 /etc/sysconfig/selinux (在RHEL5下这是一个symbolic link to /etc/selinux/conf)
# 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 - SELinux is fully disabled.
SELINUX=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

修改SELINUX=permissive,然后重新启动就可以了

Linux下禁用、启用SeLinux的更多相关文章

  1. 在Linux下禁用IPv6的方法小结

    在Linux下禁用IPv6的方法小结--http://www.jb51.net/LINUXjishu/335724.html 这篇文章主要介绍了在Linux下禁用IPv6的方法小结,禁用IPv6的操作 ...

  2. Linux下禁用笔记本触摸板

    1 概述 在Linux下禁用触摸板的方法有很多,这里列举三种: 图形界面配置关闭 modprobe关闭 xinput关闭 2 图形界面配置关闭 笔者的环境为Manjaro+Xfce,其他的桌面也应该类 ...

  3. 如何在Linux下禁用IPv6

    如何在Linux下禁用IPv6 echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6                            禁用IP ...

  4. Linux下开启关闭SeLinux

    SELinux (Security-Enhanced Linux) in Fedora is an implementation of mandatory access control in the ...

  5. Linux下如何启用MySQL数据库远程访问

    远程连接MySQL出于安全考虑,一般都关闭了远程访问,但有时候需要提供远程访问数据库的服务,下面我们快速学习下: 第一步:修改my.cnf文件使用文本编辑器去编辑MySQL服务器的配置文件my.cnf ...

  6. linux下禁用网卡的启用网卡的一些方法

    第一种方法: 这种方法主要是在不重启的情况下会一直生效,适用于服务器. #禁用网卡eth0 sudo ifconfig eth0 down #启用网卡eth0 sudo ifconfig eth0 u ...

  7. linux下禁用SELinux

    http://chenzhou123520.iteye.com/blog/1313582 如何开启或关闭SELinux RedHat的 /etc/sysconfig/selinux 在新版本中的Red ...

  8. linux下目录简介——/SElinux

    一.前言 安全增强型 Linux(Security-Enhanced Linux)简称 SELinux,它是一个 Linux 内核模块,也是 Linux 的一个安全子系统. SELinux 主要由美国 ...

  9. linux配置禁用启用IPv6

    IPv6被认为是IPv4的替代产品,它用来解决现有IPv4地址空间即将耗尽的问题.但目前,开启IPv6可能会导致一些问题.因此有时我们需要关闭IPv6.下面是IPv6的关闭方法应该适用于所有主流的Li ...

随机推荐

  1. openerp经典收藏 深入理解报表运行机制(转载)

    深入理解报表运行机制 原文:http://blog.sina.com.cn/s/blog_57ded94e01014ppd.html 1) OpenERP报表的基本运行机制    OpenERP报表的 ...

  2. 简单的Datatable转List,Json

    这里用到了Newtonsoft.Json,下载地址:http://json.codeplex.com/ 1.根据不同的Model转为对应的List public static List<Mode ...

  3. require.js入门指南(二)

    *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...

  4. 拥抱ARM妹纸第二季 之 第三次 给我变个月亮,让约会更浪漫!

    嗯嗯,效果不错.趁着这个热乎劲,接到俺的LED测试板上试试.呃~~~ 竟然和小LED的效果不一样啊,不一样.不但闪烁而且完全没有调光效果.郁闷内,查查原因呗.看看那里出问题.迅速在PT4115手册里翻 ...

  5. (ACM)C++ STL 训练(第一天)

    因为老师说ACM考的是纯C++,所以打算抛弃VS的VC++不用了,针对纯C++的编译器有Intel Compiler(不过要钱),MinGw(个人用的),当然还有微软的VC++ 编译器,IDE你们可以 ...

  6. 微信消息处理JAXP-sax解析

    package cn.zhaokai.sax; import java.io.IOException; import java.io.InputStream; import java.io.Print ...

  7. Notes of the scrum meeting(11/1)

    meeting time:9:00~10:30p.m.,November 1st,2013 meeting place:20号公寓楼前 attendees: 顾育豪                   ...

  8. sqlserver 类似oracle的rownum功能: row_number

    select row_number() over(order by t.id ) as num,id,name from (SELECT distinct [列 0] as id ,[列 1] as ...

  9. 3573: [Hnoi2014]米特运输 - BZOJ

    Description米特是D星球上一种非常神秘的物质,蕴含着巨大的能量.在以米特为主要能源的D星上,这种米特能源的运输和储存一直是一个大问题.    D星上有N个城市,我们将其顺序编号为1到N,1号 ...

  10. plsql 使用技巧

    问题1: 每次打开plsql 布局都被恢复还原了. 你可以调整好一个布局,然后window ->Save Lay out 即可