CHCAT(8)

πŸ“¦
version 3.11 Β· 2 versions
, in centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

chcat β€” bestie, this is the one that changes SELinux security categories of files and users ✨


🌸 SYNOPSIS 🌸

chcat category file...
chcat -l category user...
chcat [[+|-]category...]  file...
chcat -l [[+|-]category...]  user...
chcat [-d] file...
chcat -l [-d] user...
chcat -L [ -l ] [ user ... ]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the vibe πŸ’… you use + and - to add or remove categories from a file or a user β€” and heads up, only a single category can be specified at a time when you're doing that. OR, plot twist, you just hand over the whole list/range of categories you want applied, and it replaces whatever categories were already there. main character energy, honestly. ✨

🚨 real talk, bestie, this one matters: when you're removing a category you must put '--' on the command line before you use the -Category syntax. That -- is basically telling the command "okay i'm done with options, everything after this is a category name, not a flag." it's giving βœ‹ stop sign, no cap.
  • -d β€” delete all categories from the given FILE/USER. every last one. bye πŸ‘‹
  • -L β€” list the available categories. window shopping fr fr πŸ›οΈ
  • -l β€” tells chcat to operate on users instead of files. lowercase L, tiny but mighty πŸ’…

πŸŽ€ EXAMPLE πŸŽ€

Replace categories of user "test" with c0.c6

# chcat -l c0.c6 test

Add category c1023 to user "test"

# chcat -l +c1023 test

Remove category c5 from file "file"

# chcat -- -c5 file

Remove all categories from file "file"

# chcat -d file

πŸ‘‘ SEE ALSO πŸ‘‘

Also, fun fact: when it's operating on files, this script is just wrapping the chcon command 🫢 like a cute lil jacket over a classic.


πŸ“ FILES πŸ“

  • /etc/selinux/{SELINUXTYPE}/setrans.conf
  • /etc/selinux/{SELINUXTYPE}/seusers

and that's the whole page, bestie!! πŸ’œ this one's the chcat manual page, from the User Commands section of the manual (section 8, for the system admin girlies), and it's dated September 2005 β€” yeah she's vintage, she's an icon, she ate and left no crumbs πŸŽ€βœ¨ slay, go change some categories, mwah πŸ’–