Linux 关闭 SELinux

临时关闭

# setenforce 0

临时打开SELinux 

# setenforce 1

查看SELinux状态

# getenforce

开机关闭SELinux  -永久关闭

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

关闭防火墙

临时关闭防火墙 

# systemctl stop firewalld

永久防火墙开机自关闭

# systemctl disable firewalld

临时打开防火墙

# systemctl start firewalld

防火墙开机启动

# systemctl enable firewalld

查看防火墙状态

# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-08-09 09:15:51 CST; 2 weeks 4 days ago
     Docs: man:firewalld(1)
 Main PID: 871 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─871 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Aug 23 13:17:25 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C PO...ame.
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C DO...ame.
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C...n?).
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C PO...ame.
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C DO...ame.
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C...n?).
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C PO...ame.
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C DO...ame.
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C...n?).
Aug 23 13:18:17 pc-cnc015.futurmaster.com firewalld[871]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C PO...ame.
Hint: Some lines were ellipsized, use -l to show in full.

Was this article helpful?

Related Articles