当前位置: 代码迷 >> 综合 >> selinux 安全机制 运行模式切换
  详细解决方案

selinux 安全机制 运行模式切换

热度:55   发布时间:2023-11-21 23:55:59.0

1.selinux 模式

enforcing (强制执行)
permissive(宽松)
disabled (彻底禁用)

2.查看系统状态

[root@room4pc09 桌面]# getenforce 
Disabled

3.修改临时模式,重启后恢复到默认状态

[root@room4pc09 桌面]# setenforce 0  #切换为permissive(宽松)模式
[root@room4pc09 桌面]# setenforce 1  #切换enforcing (强制执行)模式

4.永久模式 ,vim修改配置文件

[root@room4pc09 桌面]# vim  /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=disabled                         #把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