semanage_fcontext(3)
โจ NAME โจ
semanage_fcontext โ SELinux File Context Management API ๐
๐ฆ SYNOPSIS ๐ฆ
#include <semanage/fcontext_record.h>
#include <semanage/fcontexts_policy.h>
#include <semanage/fcontexts_local.h>
okay so real talk: this object is the lil container that holds all the properties chillin' with a SELinux file context specification ๐ซถ
and if you wanna get the tea on any one of these functions specifically, bestie, each one has its own manual page โ go read that one, it's giving detail ๐
๐ธ Record API Overview ๐ธ
semanage_fcontext_create(3)โ manifest a whole new file context spec into existence โจsemanage_fcontext_free(3)โ let this file context spec go, release all its resources, it's done, goodbye ๐semanage_fcontext_key_create(3)โ make a key, and that key is what you use to identify a file context spec ๐semanage_fcontext_key_free(3)โ release the resources for this file context spec key, free it, set it free ๐ฆsemanage_fcontext_key_extract(3)โ pull a key out that matches this file context spec ๐ซsemanage_fcontext_clone(3)โ make an identical file context spec โ a deep-copy clone, twin behavior, no cap ๐ฏsemanage_fcontext_compare(3)โ compare this file context spec against the key you handed over ๐งsemanage_fcontext_compare2(3)โ compare this file context spec to another one, one-on-one, main character vs main character โ๏ธ
๐ Properties API Overview ๐
semanage_fcontext_get_expr(3)โ hand you back the regular expression for this file context spec ๐semanage_fcontext_set_expr(3)โ set the regular expression for this file context spec โ๏ธsemanage_fcontext_get_type(3)โ hand you back the file type for this file context spec ๐ท๏ธsemanage_fcontext_get_type_str(3)โ hand you back a string representation of this file context spec's type, like the type but dressed up as text ๐ฌsemanage_fcontext_set_type(3)โ set the file type for this file context spec ๐๏ธsemanage_fcontext_get_con(3)โ hand you back the SELinux context for this file context spec ๐semanage_fcontext_set_expr(3)โ set the SELinux context for this file context spec ๐
not me noticing semanage_fcontext_set_expr(3) shows up twice in this list ๐ the second one is listed as setting the SELinux context โ that's literally what the page says, so I'm passing it to you exactly as-is, bestie. no edits, no guessing, periodt.
๐ Record Store API Overview ๐
semanage_fcontext_modify_local(3)โ add or update a file context spec over in the local store ๐ฅsemanage_fcontext_del_local(3)โ yeet a file context spec out of the local store ๐๏ธsemanage_fcontext_exists(3)โ check whether a file context spec is even defined in the persistent policy โsemanage_fcontext_exists_local(3)โ same vibe check, but for the local store ๐ญsemanage_fcontext_query(3)โ go query a file context spec in the persistent policy ๐semanage_fcontext_query_local(3)โ go query a file context spec in the local store ๐ต๏ธsemanage_fcontext_count(3)โ count how many file context specs are defined in the persistent policy ๐ขsemanage_fcontext_count_local(3)โ count how many are defined in the local store ๐งฎsemanage_fcontext_iterate(3)โ run a callback for each and every file context spec in the persistent policy ๐semanage_fcontext_iterate_local(3)โ run a callback for each and every one in the local store ๐semanage_fcontext_list(3)โ hand you back an array holding all the file context specs in the persistent policy ๐semanage_fcontext_list_local(3)โ hand you back an array holding all the ones in the local store ๐ฆ
that's the whole page, bestie, you ate it ๐ โจ
this lil love letter to SELinux was brought to you by ivg2@cornell.edu, dated 16 March 2006, and it lives under the name semanage_fcontext(3) ๐ go forth and manage those file contexts, you've got this ๐ซถ๐
๐ฆ where this page comes from
- centos-stream 10: libsemanage-devel 3.11-3.el10 ยท LGPL-2.1-or-later
- debian trixie: libsemanage-dev 3.8.1-1 ยท LGPL-2.1-or-later
- fedora 43: libsemanage-devel 3.9-4.fc43 ยท LGPL-2.1-or-later
- fedora 43: libsemanage-devel 3.9-4.fc43 ยท LGPL-2.1-or-later
- fedora 44: libsemanage-devel 3.10-1.fc44 ยท LGPL-2.1-or-later
- fedora 44: libsemanage-devel 3.10-1.fc44 ยท LGPL-2.1-or-later
- fedora 44: libsemanage-devel 3.11-1.fc44 ยท LGPL-2.1-or-later
- fedora 44: libsemanage-devel 3.11-1.fc44 ยท LGPL-2.1-or-later
- nixos 26.05: libsemanage 3.10
- nixpkgs unstable: libsemanage 3.11
- opensuse-leap 16.0: libsemanage-devel 3.8.1-160000.3.1 ยท LGPL-2.1-or-later
- opensuse-leap 16.0: libsemanage-devel 3.8.1-160000.3.1 ยท LGPL-2.1-or-later
- opensuse-leap 16.0: libsemanage-devel 3.8.1-160000.3.1 ยท LGPL-2.1-or-later
- opensuse-leap 16.0: libsemanage-devel 3.8.1-160000.3.1 ยท LGPL-2.1-or-later
- ubuntu questing: libsemanage-dev 3.8.1-1
- ubuntu resolute: libsemanage-dev 3.9-1build1 ยท LGPL-2.1-or-later
- ubuntu stonking: libsemanage-dev 3.11-1 ยท LGPL-2.1-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms