GVKun编程网logo

Centos 7.6关闭selinux(centos 7.6关闭防火墙)

11

在这里,我们将给大家分享关于Centos7.6关闭selinux的知识,让您更了解centos7.6关闭防火墙的本质,同时也会涉及到如何更有效地CentOS5.X彻底关闭SELinux、CentOS6

在这里,我们将给大家分享关于Centos 7.6关闭selinux的知识,让您更了解centos 7.6关闭防火墙的本质,同时也会涉及到如何更有效地CentOS 5.X 彻底关闭SELinux、CentOS 6.5 学习笔记 关闭 iptables, 关闭 selinux、centos 7 关闭SELINUX、centos 7.0 查看 selinux 状态 | 关闭 | 开启的内容。

本文目录一览:

Centos 7.6关闭selinux(centos 7.6关闭防火墙)

Centos 7.6关闭selinux(centos 7.6关闭防火墙)

@H_301_2@

查看selinux状态

@H_301_2@
[[email protected] ~]# 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
@H_301_2@ @H_301_2@ @H_301_2@

临时关闭

[[email protected] ~]# setenforce 0
@H_301_2@ @H_301_2@
  @H_301_2@

永久关闭

可以修改配置文件/etc/selinux/config,将其中SELINUX设置为disabled。如果不是用的root账户登录,记得前边加sudo。

[[email protected] ~]# 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=enforcing  
SELINUX=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
 
[[email protected] ~]# sestatus  
SELinux status:                 disabled
@H_301_2@ @H_301_2@
@H_301_2@
@H_301_2@

总结

以上是小编为你收集整理的Centos 7.6关闭selinux全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

CentOS相关文章

2014年关于Linux的三大预测
2014年关于Linux的三大预测
2014年Linux和开源将获成功十大预测
2014年Linux和开源将获成功十大预测
运维的85条规则
运维的85条规则
Backup Exchange 2010 R3灾难恢复模拟
Backup Exchange 2010 R3灾难恢复模拟
开源世界新格局 RedHat收编CentOS开源项目
开源世界新格局 RedHat收编CentOS开源项目
盘点适合企业的五大Linux系统应用
盘点适合企业的五大Linux系统应用
大型高性能Web站点的十项规则
大型高性能Web站点的十项规则
以“看病的思维”谈运维故障排错的思想
以“看病的思维”谈运维故障排错的思想
  • • 2014年关于Linux的三大预测
  • • 2014年Linux和开源将获成功十大预测
  • • 运维的85条规则
  • • Backup Exchange 2010 R3灾难恢复模拟
  • • 开源世界新格局 RedHat收编CentOS开源项
  • • 盘点适合企业的五大Linux系统应用
  • • 大型高性能Web站点的十项规则
  • • 以“看病的思维”谈运维故障排错的思想
  • • 红帽结盟CentOS项目 加快开源创新速度
  • • 高手详解12306IT运维架构与困境
编程问答discordterraformjenkins-pikubernetesrestapigoogle-kub笔记本amazon-ecsamazon-iamkubernetesamazon-eksnginx-reveesp32hyperledgejenkins-pl主板kubectlelastic-stdigital-ocgcloudmsalgoogle-clonginx-ingrcv2xgboostgitlab-ci-statadocker-swa蓝屏minikubebazelvalueerrorhyperledgenetcdfsplunkprismagensimwso2-amgoogle-clo
  • 友情链接:
  • 菜鸟教程
  • 前端之家
  • 编程小课
  • 小编
  • -
  • 我要投稿
  • -
  • 广告合作
  • -
  • 联系我们
  • -
  • 免责声明
  • -
  • 网站地图
版权所有 © 2018 小编 闽ICP备13020303号-8
微信公众号搜索 “ 程序精选 ” ,选择关注!
微信公众号搜"程序精选"关注
微信扫一扫可直接关注哦!

CentOS 5.X 彻底关闭SELinux

CentOS 5.X 彻底关闭SELinux

最近写东西的时候发现这个玩意太讨厌了,总是冒出一些无聊的错误让我浪费笔墨,索性直接禁用它,以后写安全方面的时候再说...

用vim打开 /etc/selinux/config

在 SELINUX=enforcing 前面加个#号注释掉它
#SELINUX=enforcing

然后新加一行
SELINUX=disabled

保存,退出,重启系统,搞定。

CentOS 6.5 学习笔记 关闭 iptables, 关闭 selinux

CentOS 6.5 学习笔记 关闭 iptables, 关闭 selinux

iptables 和 selinux 是 CentOS 6.5 内置的两道防火墙,功能强大,配置复杂,对新手极不友好.

有时,文件配置无误,但服务无法启动,多半是因为被这两道防火墙拦截了.

初学 Linux 建议关闭 iptables 和 selinux, 待熟练后再开启.

1.关闭 iptables

>>> 1.1 查看 iptables 状态

[root@ ~]#: /etc/init.d/iptables status  #  查看 iptables 状态

表格:filter  # 正在运行
Chain INPUT (policy ACCEPT)  
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
...

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

>>> 1.2 临时关闭 iptables,系统重启后, iptables 再次自动开启

 [root@ ~]#: /etc/init.d/iptables stop  # 临时关闭,重启失效 

iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]

[root@ ~]#: /etc/init.d/iptables status  # 再次查看
iptables:未运行防火墙。

>>> 1.3 永久关闭 iptables,系统重启后生效.

[root@ ~]#: chkconfig iptables off  # 永久关闭,重启后生效. 

[root@ ~]#: reboot  # 重启

[root@ ~]#: /etc/init.d/iptables status
iptables:未运行防火墙。 # 重启后不会自动开启,说明已永久关闭

如需重新开启 iptables, 使用 chkconfig iptables on, 然后 reboot.

2.关闭selinux

>>> 2.1 临时关闭 selinux, 系统重启后, selinux 再次自动开启

[root@ ~]#: /usr/sbin/sestatus  # 查看 selinux 状态

SELinux status: enabled  # 可用
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted

[root@ ~]#: setenforce 0  # 临时关闭,重启失效

[root@ ~]#: /usr/sbin/sestatus
SELinux status: enabled # 这里显示的还是"可用",但实际不可用

...

>>> 2.2 永久关闭  selinux, 重启系统后生效

[root@ ~]#: vi /etc/selinux/config  # 修改配置

1
2 # This file controls the state of SELinux on the system.
3 # SELINUX= can take one of these three values:
4 # enforcing - SELinux security policy is enforced.
5 # permissive - SELinux prints warnings instead of enforcing.
6 # disabled - No SELinux policy is loaded.
7 SELINUX=disabled  #  改 enforcing 为 disabled(不可用)
8 # SELINUXTYPE= can take one of these two values:
9 # targeted - Targeted processes are protected,
10 # mls - Multi Level Security protection.
11 SELINUXTYPE=targeted

# 保存退出.

[root@ ~]#: init 6  # 重启

[root@ ~]#: /usr/sbin/sestatus
SELinux status: disabled  # 不可用,说明已关闭

如需再次开启 selinux, 修改配置文件, 改 SELINUX=disabled 为 SELINUX=enforcing,然后 reboot.

 

centos 7 关闭SELINUX

centos 7 关闭SELINUX

vi /etc/selinux/config

#SELINUX=enforcing#注释掉

#SELINUXTYPE=targeted#注释掉

SELINUX=disabled#增加

:wq!#保存退出


setenforce 0#使配置立即生效

centos 7.0 查看 selinux 状态 | 关闭 | 开启

centos 7.0 查看 selinux 状态 | 关闭 | 开启

Linux 在安装好之后通常 SELinux 都是出于默认开启的状态,开启的情况下会导致一些服务的安装不成功。

在不需要的情况下完全可以关闭掉,下面是在 centos 7.0 里面如何查看,关闭 selinux。

查看 selinux 状态

1

2

3

4

5

6

7

8

9

10

[root@localhost ~]# 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

临时关闭

1

[root@localhost ~]# setenforce 0

永久关闭 , 可以修改配置文件 /etc/selinux/config, 将其中 SELINUX 设置为 disabled

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

[root@localhost ~]# cat /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=enforcing  

SELINUX=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

 

[root@rdo ~]# sestatus  

SELinux status:                 disabled

我们今天的关于Centos 7.6关闭selinuxcentos 7.6关闭防火墙的分享已经告一段落,感谢您的关注,如果您想了解更多关于CentOS 5.X 彻底关闭SELinux、CentOS 6.5 学习笔记 关闭 iptables, 关闭 selinux、centos 7 关闭SELINUX、centos 7.0 查看 selinux 状态 | 关闭 | 开启的相关信息,请在本站查询。

本文标签: