Centos 7如何临时和永久关闭selinux

 时间:2026-02-15 20:27:53

1、运行命令 getenforce 获取当前selinux状态

Enforcing为开启

Centos 7如何临时和永久关闭selinux

2、运行命令 sudo setenforce 0

运行命令 getenforce

状态变为 Permissive

此命令临时关闭 selinux  重启失效

Centos 7如何临时和永久关闭selinux

1、运行命令

sudo vim /etc/sysconfig/selinux

Centos 7如何临时和永久关闭selinux

2、找到行

SELINUX=enforcing

Centos 7如何临时和永久关闭selinux

3、替换为

SELINUX=disabled

保存退出

reboot

Centos 7如何临时和永久关闭selinux

4、重启后 运行命令 sestatus

SELinux status :      disabled

永久关闭selinux成功

Centos 7如何临时和永久关闭selinux

1、运行命令

sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

将 /etc/selinux/config 文件中 

SELINUX=enforcing 

替换为

SELINUX=disabled

运行命令

sudo grep SELINUX=disabled /etc/selinux/config

显示

SELINUX=disabled

确认替换修改成功

reboot

Centos 7如何临时和永久关闭selinux

2、重启后 运行命令 sestatus

SELinux status :      disabled

永久关闭selinux成功

Enjoy it !!!

Centos 7如何临时和永久关闭selinux

  • Ubuntu 开启远程登录SSH 的安装和配置
  • 如何利用CMD打开电脑本地服务
  • WMware安装银河麒麟V10桌面版
  • linux系统怎么安装?
  • 虚拟机如何设置从u盘启动?
  • 热门搜索
    治脚气最有效的方法 拉力绳锻炼方法图解 太监怎么小便 长安cs35怎么样 节约用水的方法 萝卜饼的家常做法 荣威怎么样 做红烧肉的方法 climate怎么读 2345网址大全