restorecon_xattr(8)
π restorecon_xattr β the SELinux User Command bestie π
okay so real talk, this is restorecon_xattr from section 8 of the manual (SELinux User Command, iykyk) and she is here to help you manage those security.sehash extended attribute entries that setfiles(8) or restorecon(8) left behind. no cap.
β¨ NAME β¨
restorecon_xattr β manage security.sehash extended attribute entries added by setfiles(8) or restorecon(8). π
π¦ SYNOPSIS π¦
restorecon_xattr [-d] [-D] [-m] [-n] [-r] [-v] [-e directory] [-f
specfile] pathname
like. that's the whole vibe. seven flags and a pathname, slay. π
πΈ DESCRIPTION πΈ
restorecon_xattr will display the SHA1 digests added to extended attributes security.sehash, or delete the attribute completely. these attributes get set by restorecon(8) or setfiles(8) onto specified directories when relabeling recursively. periodt.
she's genuinely so useful for managing the extended attribute entries, especially when users literally forget what directories they ran restorecon(8) or setfiles(8) from. not me forgetting, couldn't be me π (it is me).
β οΈ heads up bestie: RAMFS and TMPFS filesystems do not support the security.sehash extended attribute and are automatically excluded from searches. so don't come for her when they don't show up, she's doing her best π
by default, restorecon_xattr will display the SHA1 digests with "Match" appended if they match the default specfile set or the specfile set used with the -f option. non-matching SHA1 digests will be displayed with "No Match" appended. you can turn this feature off with the -n option. iconic behaviour honestly π
π OPTIONS π
-dβ delete all non-matchingsecurity.sehashdirectory digest entries. bye felicia π«Ά-Dβ delete ALLsecurity.sehashdirectory digest entries. every single one. no survivors. π-mβ do not read/proc/mountsto obtain a list of non-seclabel mounts to be excluded from relabeling checks. setting-mis useful where there is a non-seclabel fs mounted with a seclabel fs mounted on a directory below this.-nβ do not append"Match"or"No Match"to displayed digests. just the numbers, raw and unfiltered β¨-rβ recursively descend directories. go deep bestie π-vβ display SHA1 digest generated by specfile set. (note that this digest is not used to match thesecurity.sehashdirectory digest entries, and is shown for reference only). so like, look at it, don't rely on it π-edirectoryβ directory to exclude (repeat the option for more than one directory). stack 'em π-fspecfileβ an optional specfile containing file context entries as described infile_contexts(5). if the option is not specified, then the defaultfile_contextswill be used.
π ARGUMENTS π
pathnameβ the pathname of the directory tree to be searched. main character of the command honestly π
π₯ EXAMPLE π₯
list all paths that where assigned a checksum by "restorecon/setfiles -D":
# restorecon_xattr -r /
remove all non-matching checksums:
# restorecon_xattr -rd /
see how easy that was?? two lines. ate. π β¨
π SEE ALSO π
and that's the whole page bestie, go forth and manage those xattrs π¦π
pssst, this one's from the SELinux User Command crew, dated 24 Sept 2016 β so like, vintage but still serving. mwah, no notes. πβ¨
π¦ where this page comes from
- debian trixie: policycoreutils 3.8.1-2
- fedora 43: policycoreutils 3.9-5.fc43 Β· GPL-2.0-or-later
- nixos 26.05: policycoreutils 3.11
- nixpkgs unstable: policycoreutils 3.11
- opensuse-leap 16.0: policycoreutils 3.8.1-160000.5.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: policycoreutils 3.8.1-160000.5.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: policycoreutils 3.8.1-160000.5.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: policycoreutils 3.8.1-160000.5.1 Β· GPL-2.0-or-later
- ubuntu questing: policycoreutils 3.8.1-1
- ubuntu resolute: policycoreutils 3.9-2
- ubuntu stonking: policycoreutils 3.11-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms