get_default_context_with_level - Linux


Overview

get_default_context_with_level retrieves the default security context for a given service or domain. This context is used to ensure that new processes created by the service or domain inherit the correct security attributes.

Syntax

get_default_context_with_level [-ns] <service_name|domain>

Options/Flags

  • -n: Retrieve the context without the MLS label.
  • -s: Retrieve the context without the SID.

Examples

Get the default security context for the httpd service:

get_default_context_with_level httpd

Get the default security context for the example.com domain:

get_default_context_with_level example.com

Get the default security context for the httpd service without the MLS label:

get_default_context_with_level -n httpd

Common Issues

If the specified service or domain does not exist, an error message will be displayed.

Integration

get_default_context_with_level can be used with other commands to manage security contexts, such as set_default_context_with_level.

Related Commands

  • set_default_context_with_level
  • getsebool
  • setsebool