LoginSignup
63
82

More than 5 years have passed since last update.

CentOS7 SELinuxの無効化手順

Last updated at Posted at 2015-12-27

概要

SELinuxは、WindowsでいうところのUACのような機能だが、サーバーとして動作させる際に、予期せぬ制約がかかることが多いので無効化しておく。

設定ファイルの修正

現状の設定を確認する。以下のコマンドで、現在の設定を確認する。
CentOS7 (1708) Minimalの導入直後であれば、「Enforcing」となっている。

SELinuxの設定状況を確認
getenforce

<出力結果>
Enforcing

以下のコマンドで、設定ファイルをバックアップする。

設定ファイルのバックアップ(rootユーザで実行)
cp -piv /etc/selinux/config /etc/selinux/config.`date "+%Y%m%d"`

<出力結果>
‘/etc/selinux/config’ -> ‘/etc/selinux/config.YYYYMMDD’

以下の設定ファイルを修正する。

/etc/selinux/config
# 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.
### Disalbe SELINUX begin
##SELINUX=enforcing
SELINUX=disabled
### Disalbe SELINUX end
# 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

再起動

以下のコマンドで再起動する。

OS再起動(rootユーザで実行)
shutdown -r now

結果の確認

再起動後に以下のコマンドで、状態を確認する。
「Disabled」になっていれば良い。

SELinuxの設定状況を確認
getenforce

<出力結果>
Disabled

次の手順

CentOS7 パッケージ管理(インストール済みRPMの最新化)

以上

63
82
0

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
63
82