LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   How To Check SELinux Status (NO GUI) (https://www.linuxquestions.org/questions/red-hat-31/how-to-check-selinux-status-no-gui-620864/)

carlosinfl 02-13-2008 11:58 AM

How To Check SELinux Status (NO GUI)
 
Is it possible to run a command on the CLI to check the status of SELinux w/o having to run "system-config-securitylevel"?

Micro420 02-13-2008 12:39 PM

cat /etc/sysconfig/selinux

carlosinfl 02-13-2008 12:55 PM

Thanks!

I also found the command

Code:

sestatus
That is also very simple.

Thank you!

mtimbro 02-18-2008 07:36 AM

Quote:

Originally Posted by Carlwill (Post 3055929)
Thanks!

I also found the command

Code:

sestatus
That is also very simple.

Thank you!

You can also change the policy live like this:

setenforce 0 'to disable
setenforce 1 'to enable

Very practical on a production server when you can't edit /etc/selinux/config and reboot the machine.

Cheers,

Micro420 02-18-2008 01:50 PM

Quote:

Originally Posted by mtimbro (Post 3061303)
You can also change the policy live like this:

setenforce 0 'to disable
setenforce 1 'to enable

Very practical on a production server when you can't edit /etc/selinux/config and reboot the machine.

Cheers,

But I thought it would still require a reboot to take effect, no?

billymayday 02-18-2008 03:01 PM

No, setenforce is only valid up until the next boot (ie once you reboot the status will revert to system settings)

mtimbro 02-20-2008 07:07 AM

Quote:

Originally Posted by Micro420 (Post 3061664)
But I thought it would still require a reboot to take effect, no?

Here is the way to disable selinux:

1-Edit /etc/selinux/config and set the SELINUX variable to 'disabled'
2-Use the setenforce command to disable on-the-fly

With solution 1, your changes are permanent but only effective if you reboot the machine.

With solution 2, your changes are NOT permanent but effective immediately.

Hope this clears it up :-).

R03L 01-03-2011 09:28 AM

opinion
 
Ondough my opinion is selinux in grub is disabled by setting enforcing 0

my thinking say's to me it is Verry important,
for to no sure reasons to set

Code:

SELINUX=permissive
Code:

SELINUXTYPE=#      strict - Full SELinux protection.
afther i done this

selinux takes a "long" time to relable the whole system

whit a cup of coffee 8)

Quote:

Java2groovy and grape were conflicting s0?
using the same filetype

Code:

| ?!><!? |
Quote:

Quote:

Slow entertaining!


misconfiguration 01-03-2011 12:21 PM

To quickly check if SELinux is running use the following command.

Quote:

# getenforce

R03L 01-03-2011 01:47 PM

well it is such a hell to get vmware working again that i considert disabeling selinux fully


getenforce
Disabled

but relabeling is not an option on the disable option???
???
???

reboot is not relabeling!?

i say to myself this is a forced way to MUST use SELinux

remove selinux
or you try yum remove akonadi or selinux?

it try's to remove half the system!??

R03L 01-03-2011 01:47 PM

and what is national rational doing internationaly?

misconfiguration 01-04-2011 09:10 AM

Quote:

Originally Posted by R03L (Post 4211769)
well it is such a hell to get vmware working again that i considert disabeling selinux fully


getenforce
Disabled

but relabeling is not an option on the disable option???
???
???

reboot is not relabeling!?

i say to myself this is a forced way to MUST use SELinux

remove selinux
or you try yum remove akonadi or selinux?

it try's to remove half the system!??

*** DO NOT UNINSTALL ANY SELINUX PACKAGES ***

Why would you want to disable or remove SELinux in the first place? It's put on the systems for a reason - to protect your data. I would first recommend simply learning the basics and keep your boxes running in "enforcing mode". If you absolutely *MUST* disable SELinux you can do so like this.


The SELinux config file is here:
Quote:

/etc/selinux/config
First you must edit the SELinux config file and change the "SELINUX=enforcing" to:
Quote:

SELINUX=disabled
Reboot

* Please note *

You don't have to relabel the OS once you disable SELinux and reboot. The system would automatically have to relabel the FS if you were to turn SELinux back on and reboot. Albeit if you *MUST* relabel the entire FS, I suggest using the trick similar to "forcefsck".

Run this command and reboot:
Quote:

touch /.autorelabel

R03L 01-04-2011 10:53 AM

Ok yankyou

unSpawn 01-04-2011 01:01 PM

Quote:

Originally Posted by R03L (Post 4211769)
well it is such a hell to get vmware working again that i considert disabeling selinux fully

Remember that posting exact error messages usually gets you more precise answers.

divyashree 01-10-2011 12:41 AM

Quote:

Originally Posted by carlosinfl (Post 3055867)
Is it possible to run a command on the CLI to check the status of SELinux w/o having to run "system-config-securitylevel"?

Type:

Code:

getenforce


All times are GMT -5. The time now is 05:25 AM.