CHCON(1)
π chcon β change file security context π
ok bestie, welcome to your manual page for chcon, which is a User Commands situation from the GNU coreutils girlies β¨. chcon is short for "change context," and she changes the SELinux security context. She's giving security-label glow-up, she's giving filesystem main character energy, and she is genuinely so easy once we get through this together. π
π¦ SYNOPSIS π¦
chcon [OPTION]... CONTEXT FILE...
chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
chcon [OPTION]... --reference=RFILE FILE...
like, three ways in, pick your fighter π
πΈ DESCRIPTION πΈ
so the whole vibe: change the SELinux security context of each FILE to CONTEXT. and with --reference, change the security context of each FILE to that of RFILE. that's it. that's the job. π
β οΈ real talk before we go any further: mandatory arguments to long options are mandatory for short options too. no cap. if a long option needs a value, the short version needs it too.
β¨ the options, one by one, no skips β¨
--dereferenceβ affect the referent of each symbolic link (this is the default), rather than the symbolic link itself. so by default we're messing with the thing the symlink points at, not the symlink. iconic behaviour tbh π«Ά-h,--no-dereferenceβ affect symbolic links instead of any referenced file. flip it, now we're changing the link itself π¦-u,--user=USERβ set userUSERin the target security context β¨-r,--role=ROLEβ set roleROLEin the target security context π-t,--type=TYPEβ set typeTYPEin the target security context π-l,--range=RANGEβ set rangeRANGEin the target security context π--no-preserve-rootβ do not treat/specially (the default). yes queen,/is just another path here π--preserve-rootβ fail to operate recursively on/. the responsible option. the one your sysadmin bestie wants you to use π--reference=RFILEβ useRFILE's security context rather than specifying aCONTEXTvalue. copy the drip, don't type it out π₯-R,--recursiveβ operate on files and directories recursively. your whole little tree, all of it, every single one π-v,--verboseβ output a diagnostic for every file processed. she's telling you everything, and honestly? we love that for us π
π§ how the traversal goes down π§
the following options modify how a hierarchy is traversed when the -R option is also specified. if more than one is specified, only the final one takes effect. -P is the default. periodt. β¨
-Hβ if a command line argument is a symlink to a directory, traverse it πΈ-Lβ traverse every symbolic link to a directory encountered π¦-Pβ do not traverse any symbolic links π
π and the two classics π
--helpβ display this help and exit π«Ά--versionβ output version information and exit β
π AUTHOR π
Written by Russell Coker and Jim Meyering. legends, fr fr π
π£ REPORTING BUGS π£
Report bugs to: bug-coreutils@gnu.org
GNU coreutils home page: https://www.gnu.org/software/coreutils/
General help using GNU software: https://www.gnu.org/gethelp/
Report any translation bugs to https://translationproject.org/team/
π SEE ALSO π
Full documentation https://www.gnu.org/software/coreutils/chcon
or available locally via: info '(coreutils) chcon invocation'
Packaged by Ubuntu (9.10-1ubuntu2)
Copyright Β© 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
and that's the whole page bestie!! ππ¦β¨ this one comes to you from GNU coreutils 9.10, dated August 2026, and it's CHCON(1) in the User Commands section β go forth and label responsibly, mwah ππ
π«Ά
π¦ where this page comes from
- ubuntu stonking: gnu-coreutils 9.10-1ubuntu2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms