matchpathcon(8) SELinux Command Line documentation matchpathcon(8)

# [NAME](#NAME)

matchpathcon - get the default SELinux security context for the specified path from the file contexts configuration

# [SYNOPSIS](#SYNOPSIS)

**matchpathcon** \[**-V**] \[**-N**] \[**-n**] \[**-m** *type*] \[**-f** *file\_contexts\_file*] \[**-p** *prefix*] \[**-P** *policy\_root\_path*] *filepath...*

# [DESCRIPTION](#DESCRIPTION)

**matchpathcon** queries the system policy and outputs the default security context associated with the filepath.

**Note:** Identical paths can have different security contexts, depending on the file type (regular file, directory, link file, char file ...).

**matchpathcon** will also take the file type into consideration in determining the default security context if the file exists. If the file does not exist, no file type matching will occur.

# [OPTIONS](#OPTIONS)

[**-m type**](#m)

Force file type for the lookup. Valid types are **file**, **dir**, **pipe**, **chr\_file**, **blk\_file**, **lnk\_file**, **sock\_file**

[**-n**](#n)

Do not display path

[**-N**](#N)

Do not use translations

[**-f file\_context\_file**](#f)

Use alternate file\_context file

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

Use prefix to speed up translations

[**-P policy\_root\_path**](#P)

Use alternate policy root path

[**-V**](#V)

Verify file context on disk matches defaults

# [EXAMPLE](#EXAMPLE)

```
Show the default label of sock_file cups.sock
# matchpathcon -m sock_file /var/run/cups/cups.sock
Verify that /var/www/html directory is labeled correctly (the content of the folder is not checked)
# matchpathcon -V /var/www/html
```

# [AUTHOR](#AUTHOR)

This manual page was written by Dan Walsh &lt;dwalsh@redhat.com&gt;.

# [SEE ALSO](#SEE_ALSO)

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

21 April 2005 dwalsh@redhat.com

---

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