美文网首页
centOS7 Linux 防火墙和SELinux的开启和关闭

centOS7 Linux 防火墙和SELinux的开启和关闭

作者: 程序员的自我修养 | 来源:发表于2020-05-28 14:58 被阅读0次

    防火墙(firewalld)

    临时关闭防火墙 

    systemctl stop firewalld

    永久防火墙开机自关闭 

    systemctl disable firewalld

    临时打开防火墙 

    systemctl start firewalld

    防火墙开机启动 

    systemctl enable firewalld

    查看防火墙状态 

    systemctl status firewalld

    [root@localhost ~]# systemctl status firewalld

    ● firewalld.service- firewalld - dynamic firewall daemon

    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: ena bled)

    Active: active (running) since Sat2017-04-0810:36:57CST; 31s ago

    Main PID:2856(firewalld)

    CGroup: /system.slice/firewalld.service

    └─2856/usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

    Apr0810:36:56localhost.localdomainsystemd[1]: Starting firewalld - dynamic firewal....

    Apr0810:36:57localhost.localdomainsystemd[1]: Started firewalld - dynamic firewall....

    Hint:Some lines were ellipsized, use -l to showinfull.

    [root@localhost ~]#

    SELinux

    临时关闭SELinux 

    setenforce 0

    临时打开SELinux 

    setenforce 1

    查看SELinux状态 

    getenforce

    开机关闭SELinux 

    编辑/etc/selinux/config文件,如下图,将SELINUX的值设置为disabled。下次开机SELinux就不会启动了。 

    注意,此时也不能通过setenforce 1命令临时打开。

    [root@localhost~]# setenforce 1setenforce: SELinuxisdisabled

    1

    2

    需要修改配置文件,然后重启linux后,才可以再打开SELinux

    相关文章

      网友评论

          本文标题:centOS7 Linux 防火墙和SELinux的开启和关闭

          本文链接:https://www.haomeiwen.com/subject/prhuohtx.html