---
name: "matchmediacon"
section: "3"
platform: "linux"
package: "libselinux1-dev"
version: "3.8.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/matchmediacon"
---

# matchmediacon(3)

get the default SELinux security context for the specified mediatype from the policy

## NAME

matchmediacon - get the default SELinux security context for the specified mediatype from the policy

## SYNOPSIS

**#include \<selinux/selinux.h\>**

**int matchmediacon(const char \****media***, char \*\****con***);**

## DESCRIPTION

**matchmediacon**() matches the specified media type with the media contexts configuration and sets the security context *con* to refer to the resulting context.

**Note:** Caller must free returned security context *con* using [**freecon**(3)](/freecon/3.md).

## RETURN VALUE

Returns 0 on success or -1 otherwise.

## Files

*/etc/selinux/{POLICYTYPE}/contexts/files/media*

## SEE ALSO

[**selinux**(8)](/selinux/8.md), [**freecon**(3)](/freecon/3.md)
