Bookmark this page

Practice: Changing SELinux Modes

In this lab, you will manage SELinux modes, both temporarily and persistently.

Resources
Machines: serverX

Outcomes:

You will get practice viewing and setting the current SELinux mode.

  1. Log in as root on serverX. Display the current SELinux mode.

    [root@serverX ~]# getenforce
    Enforcing
    
  2. Change the default SELinux mode to permissive and reboot.

    [root@serverX ~]# vi /etc/selinux/config
    [root@serverX ~]# grep '^SELINUX' /etc/selinux/config
    SELINUX=permissive
    SELINUXTYPE=targeted
    [root@serverX ~]# reboot
    
  3. When serverX comes back up, log in as root and display the current SELinux mode.

    [root@serverX ~]# getenforce
    Permissive
    
  4. Change the default SELinux mode to enforcing.

    [root@serverX ~]# vi /etc/selinux/config
    [root@serverX ~]# grep '^SELINUX' /etc/selinux/config
    SELINUX=enforcing
    SELINUXTYPE=targeted
    
  5. Set the current SELinux mode to enforcing.

    [root@serverX ~]# setenforce 1
    [root@serverX ~]# getenforce
    Enforcing
    
Revision: rh134-7-c643331