restorecon_xattr(8)

πŸ“¦
version 3.11 Β· 3 versions
, in debian trixie, fedora 43, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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-matching security.sehash directory digest entries. bye felicia 🫢
  • -D β€” delete ALL security.sehash directory digest entries. every single one. no survivors. πŸ’€
  • -m β€” do not read /proc/mounts to obtain a list of non-seclabel mounts to be excluded from relabeling checks. setting -m is 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 the security.sehash directory digest entries, and is shown for reference only). so like, look at it, don't rely on it πŸ’…
  • -e directory β€” directory to exclude (repeat the option for more than one directory). stack 'em πŸŽ€
  • -f specfile β€” an optional specfile containing file context entries as described in file_contexts(5). if the option is not specified, then the default file_contexts will 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 πŸ’–

restorecon(8), setfiles(8)


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. πŸŽ€βœ¨