Jesin's Blog

Welcome to the Portal of Technology

  • Facebook
  • GitHub
  • RSS
  • Twitter
  • Home
  • Categories
    • Domains
    • Linux
    • Networking
    • PHP
    • Virtualization
    • Web Design
    • Web Servers
    • Windows
  • WordPress Plugins
    • Custom Error Pages
    • HTTP Digest Authentication
    • Mailgun Email Validator
  • Toolbox
    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool
  • About Me
  • Contact Me
  • Sitemap
Home ›
Linux ›
How to Change SELinux modes

How to Change SELinux modes

May 2, 2011 Linux Jesin A Leave a Comment

selinux penguin

The SELinux (Security Enhanced Linux) is a feature of Linux operating systems which bullet poofs your system against security holes even if you accidentally chmod a file or directory to 777. It uses file contexts to find which files belongs to what type. SELinux operates in many different modes and this article I’ll show you how to switch between these modes temporarily or permanently. I’ll also show you how to disable selinux completely, but be warned do not do this unless you know what you’re doing.

SELinux modes

Enforcing – This is the default mode, all selinux contexts and policies are enforced and policy violations are both blocked and logged.

Permissive – This mode can be used for debugging, doesn’t enforce the policy but policy violations are logged in /var/log/audit/audit.log

Disabled – SELinux is completely turned off and nothing is logged, this is the most insecure mode.

Changing modes with setenforce

the setenforce command can be used to temporarily set the SELinux mode, when the system is restarted the previous mode comes to place

setenforce 0
setenforce 1
getenforce

Permanently changing the selinux mode

Open the file /etc/selinux/config with a text editor and locate and change

SELINUX=mode

to any of the following

SELINUX=enforcing
SELINUX=permissive
SELINUX=disabled

The last mode disables SELinux entirely so use it with caution.

Related posts:

change default runlevel in linuxHow to change the default runlevel in Linux windows category thumbnailHide Last Logged in Username in Windows (Security Policy) linux password lockout policy thumbnailLinux password lockout policy How to save IPtables rules in Debian linux category thumbnailChange Home Directory in Linux

Tags: linux, linux system files, selinux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get a wealth of information delivered to your inbox. Subscribe and never miss a single article.

  • Tutorials and howtos
  • Code, scripts and commands
  • Online Tools

* No spam, unsubscribe anytime

Hire Me

  • SSL installation and hardening (A+ on Qualys SSL test)
  • Apache & Nginx configuration
  • Email deliverability improvement (10/10 on Mail Tester & MailGenius)
  • WordPress customization, optimization and migration
  • and much more…

    Tools

    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool

    Nav

    • Home
    • About Me
    • Contact Me
    • Privacy Policy
    • Sitemap
    Vultr SSD VPS

    Creative Commons License
    Jesin's Blog by Jesin A is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
    Based on a work at websistent.com.