如何关闭防火墙和selinux

防火墙关闭

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

关闭selinux

[root@localhost ~]# setenforce 0
[root@localhost ~]# vi /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 values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are
protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost ~]# getenforce ##查看当前selinux的状态
Disabled
3 Likes

好奇,大部分企业都会关掉selinux吗

我是经常关这个。

sed -i ‘s/SELINUX=enabled/SELINUX=disabled/’ /etc/selinux/config