ホームページ  >  記事  >  運用・保守  >  SELinuxをオフにする方法

SELinuxをオフにする方法

藏色散人
藏色散人オリジナル
2020-05-29 11:43:406139ブラウズ

SELinuxをオフにする方法

selinux をオフにする方法は?

#selinux を閉じる

1. コマンド「getenforce」を使用して selinux のステータスを取得します。

推奨事項:「

##」 #linux チュートリアル>>

[root@localhost ~]# getenforce
Enforcing        //enforceing代表开启,
 
[root@localhost ~]# getenforce
Permissive      // permissive代表警告
 
[root@localhost ~]# getenforce
Disabled        //disabled代表关闭
[root@localhost ~]#
2. ターミナルにコマンドを入力して selinux をシャットダウンします。この方法は一時的にシャットダウンするだけであり、再起動後は効果がありません。

[root@localhost ~]# setenforce 0    //关闭
[root@localhost ~]# getenforce
Permissive         
 
[root@localhost ~]# setenforce 1    //开启
[root@localhost ~]# getenforce
Enforcing

3. 設定ファイル「/etc/sysconfig/selinux」を使用して、selinux のステータスを変更します。この方法では、マシンを再起動する必要があります。

[root@localhost ~]# gedit /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

4. 「/boot/grub/menu」を変更して、selinux をオフにします。 lst」を選択すると、コンピュータの電源を入れるたびに動作しなくなります。selinux

[root@localhost ~]# gedit /boot/grub/menu.lst 
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-431.el6.i686)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-431.el6.i686 ro root=/dev/mapper/VolGroup-lv_root nomodeset rd_NO_LUKS rd_NO_MD rd_LVM_LV=VolGroup/lv_swap crashkernel=auto vga=ask.UTF-8 rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet selinux=0
        initrd /initramfs-2.6.32-431.el6.i686.img
を起動します。

以上がSELinuxをオフにする方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。