sefcontext\_compile(8) SELinux Command Line documentation sefcontext\_compile(8)

# [NAME](#NAME)

sefcontext\_compile - compile file context regular expression files

# [SYNOPSIS](#SYNOPSIS)

**sefcontext\_compile** \[**-o** *outputfile*] \[**-p** *policyfile*] *inputfile*

# [DESCRIPTION](#DESCRIPTION)

**sefcontext\_compile** is used to compile file context regular expressions into [**pcre**(3)](/man/os/libselinux/pcre.3) format.

The compiled file is used by libselinux file labeling functions.

By default **sefcontext\_compile** writes the compiled pcre file with the **.bin** suffix appended (e.g. *inputfile.bin*).

# [OPTIONS](#OPTIONS)

[**-o**](#o)

Specify an *outputfile* that must be a fully qualified file name as the **.bin** suffix is not automatically added.

[**-p**](#p)

Specify a binary *policyfile* that will be used to validate the context entries in the *inputfile*  
If an invalid context is found the pcre formatted file will not be written and an error will be returned.

# [RETURN VALUE](#RETURN_VALUE)

On error -1 is returned. On success 0 is returned.

# [EXAMPLES](#EXAMPLES)

**Example 1:**  
sefcontext\_compile /etc/selinux/targeted/contexts/files/file\_contexts

Results in the following file being generated:

/etc/selinux/targeted/contexts/files/file\_contexts.bin

**Example 2:**  
sefcontext\_compile -o new\_fc.bin /etc/selinux/targeted/contexts/files/file\_contexts

Results in the following file being generated in the cwd:

new\_fc.bin

# [AUTHOR](#AUTHOR)

Dan Walsh, &lt;dwalsh@redhat.com&gt;

# [SEE ALSO](#SEE_ALSO)

[**selinux**(8)](/man/os/libselinux/selinux.8), [**semanage**(8)](/man/os/libselinux/semanage.8),

12 Aug 2015 dwalsh@redhat.com

---

Document: sefcontext_compile(8) from libselinux 3.11-r2 (Chainguard OS)
Source: https://github.com/SELinuxProject/selinux.git
