如何在 ubuntu 14.04 中将 selinux 模式从宽容更改为强制。
我试过
# vim /etc/selinux/config
SELINUX=enforcing
save and quiet
# init 6
之后...没有运气。当我执行getenforce
命令时显示已禁用。
答案1
只需以 root 身份运行即可setenforce 1
。执行此操作的一种方法是运行sudo setenforce 1
。
sestatus
您可以通过运行并检查输出来验证它是否成功。
[root@ec2-54-183-55-79 filebeat]# setenforce 1
[root@ec2-54-183-55-79 filebeat]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
答案2
这个主意怎么样?打开终端
sudo -i
cd /etc/selinux/
gedit 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:
# default - equivalent to the old strict and targeted policies
# mls - Multi-Level Security (for military and educational use)
# src - Custom policy built from source
SELINUXTYPE=ubuntu
# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0
进行更改并另存为