Linux关闭Selinux以及简单操作

                                 Linux Selinux 简单操作

 

         Selinux 是linux中的安(霸)全(道)系统 ,它由NSA编写并设计成内核模块包含到内核中,相应的某些安全相关的应用也被打了SELinux的补丁,最后还有一个相应的安全策略。任何程序对其资源享有完全的控制权。假设某个程序打算把含有潜在重要信息的文件扔到/tmp目录下,那么在DAC情况下没人能阻止他。SELinux提供了比传统的UNIX权限更好的访问控制

平常如果需要简单操作

chcon -t xxxx 命令

简单操作

1.状态查看命令  :getenforce

#查看selinux 状态
[root@localhost /]# getenforce
Enforcing

该命令有三种状态结果

Enforcing     (1)            强制模式         ---安全级别最高,相对的操作权限更低

Permissive   (0)           自由模式          ---安全级别较低,操作权限稍高

Disabled                            关闭模式         ---永久关闭模式,安全级别没有,操作权限最高

2.开启自由模式/临时关闭:setenforce 0 (其实就相当于将状态改为上面的Permissive 模式)

[root@localhost /]# setenforce 0

3.切换为强制模式:setenforce 1  (将状态切回到Enforcing模式)

[root@localhost /]# setenforce 1

4.永久关闭Selinux

     修改/etc/sysconfig/selinux 文件中的配置并且重启服务器

[root@localhost /]# vi /etc/sysconfig/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=disabled    #将这里的enforcing 改为 disabled 
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值