关闭防火墙及SELINUX(CentOS)

一、CentOS(6.5)

关闭:service iptables stop
状态:service iptables status
永久关:chkconfig iptables off

[root@FTPServer ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@FTPServer ~]# service iptables status
iptables: Firewall is not running.
[root@FTPServer ~]# chkconfig iptables off
[root@FTPServer ~]# chkconfig --list | grep iptables
iptables       	0:off	1:off	2:off	3:off	4:off	5:off	6:off

二、CentOS(7.*)

关闭:systemctl stop firewalld
状态:systemctl status firewalld
永久关:systemctl disable firewalld

[root@ftpserver ~]# systemctl stop firewalld
[root@ftpserver ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@ftpserver ~]# systemctl disable firewalld

三、关闭SELINUX

这个不区分版本,直接修改:vi /etc/selinux/config
将SELINUX=enforcing 设置成SELINUX=disabled

[root@ftpserver ~]# cat /etc/sysconfig/selinux 

# 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
# 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

发表回复