LoginSignup
161
166

More than 5 years have passed since last update.

SELinuxの無効化

Last updated at Posted at 2017-06-27

概要

1.SELinuxを一時的にオフにする方法
2.SELinuxを永続的にオフにする方法

環境

CentOS7

現在の状態確認方法

状態一覧
・enforcing ・・・ SELinuxは有効で、アクセス制限も有効。
・permissive ・・・ SELinuxは有効だが、アクセス制限は行わず警告を出力。
・disabled ・・・ SELinux機能は無効。

実行ログ

# getenforce
  Enforcing

一時的に無効にする

# setenforce 0

で、設定が"Permissive"になる。

# setenforce 1

で、設定がEnforcingになる。

永続的に無効にする

上の方法だと、再起動するたびにコマンド打たなきゃいけない。
毎回めんどくさいです。
ということで、設定ファイルを書き換えましょう。

# vi /etc/selinux/config
SELINUX=enforcing

enforcingをdisabledに変えましょう。

サーバ再起動

変更した設定は再起動しなければ反映されない。

# reboot

念のため確認しましょ。

# getenforce
  Disabled

できた!

これで面倒なSELinuxから解放された...
再起動のたびにエラーが出てきて、試行錯誤した結果、
またSELinux解除を忘れてた!
ってのがしょっちゅうあってとてつもなくイライラしたので。笑

161
166
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
161
166