自宅サーバー ≫ Linux Server ≫ CentOS 7 ≫ SELinuxの無効化&ファイアーフォールの停止

 
SELinux
SELinux はアクセス制限を細かく設定できるセキュリティーシステムですが設定が細かく複雑なため十分な知識と経験が無いと各種アプリケーションが正常に動作しなくな る

また、ファイヤーウォールはルーターが同じ機能を果たしているので二重の設定をする事もないので SELinux の無効化とファイアーフォールを停止する

SELinuxの有効・無効確認

 [root@
centos]# getenforce
 Enforcing
   <--- Enforcing と表示された場合は有効(Permissive と表示された場合は無効)
 
上記で Permissive と表示された場合は無効化されているので以後の作業は不要
SELinux の無効化

 [root@
centos]# setenforce 0
 
SELinux の無効化を確認

 [root@
centos]# getenforce
 Permissive
   <--- Permissive と表示されたので無効化された
 
PCの再起動に SELinux を無効化する
 
 [root@
centos]# vi /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=enforcing
   <--- 書き換え
         ↓
 SELINUX=disabled
 
 
以下略
 
ファイアーフォールの停止
CentOS7 より新たなファイアウォールとして firewalld というのが実装されました
今までの iptables も使えますが両方は使えず、どちらか片方が起動している時はもう片方が停止しています
そこで両方とも停止する事にします

 [root@
centos]# systemctl stop iptables
 [root@
centos]# systemctl stop firewalld
 
ファイアーフォールの自動起動解除設定

 [root@
centos]# systemctl disable iptables
 [root@
centos]# systemctl disable firewalld
 
自動起動解除設定の確認


 [root@centos]# systemctl list-unit-files | grep iptables
 iptables.service                                  disabled
   <--- disabled になっていればOK
 
[root@centos]# systemctl list-unit-files | grep firewalld
 iptables.service                                  disabled
   <--- disabled になっていればOK
 

戻る