CHCON(1) User Commands CHCON(1)

# [NAME](#NAME)

chcon - change file security context

# [SYNOPSIS](#SYNOPSIS)

**chcon** \[*OPTION*]... *CONTEXT FILE*...  
**chcon** \[*OPTION*]... \[*-u USER*] \[*-r ROLE*] \[*-l RANGE*] \[*-t TYPE*] *FILE*...  
**chcon** \[*OPTION*]... *--reference=RFILE FILE*...

# [DESCRIPTION](#DESCRIPTION)

Change the SELinux security context of each FILE to CONTEXT. With **--reference**, change the security context of each FILE to that of RFILE.

Mandatory arguments to long options are mandatory for short options too.

[**--dereference**](#dereference)

affect the referent of each symbolic link (this is the default), rather than the symbolic link itself

[**-h, --no-dereference**](#h,)

affect symbolic links instead of any referenced file

[**-u, --user=USER**](#u,)

set user USER in the target security context

[**-r, --role=ROLE**](#r,)

set role ROLE in the target security context

[**-t, --type=TYPE**](#t,)

set type TYPE in the target security context

[**-l, --range=RANGE**](#l,)

set range RANGE in the target security context

[**--no-preserve-root**](#no)

do not treat '/' specially (the default)

[**--preserve-root**](#preserve)

fail to operate recursively on '/'

[**--reference=RFILE**](#reference=RFILE)

use RFILE's security context rather than specifying a CONTEXT value

[**-R, --recursive**](#R,)

operate on files and directories recursively

[**-v, --verbose**](#v,)

output a diagnostic for every file processed

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.

[**-H**](#H)

if a command line argument is a symlink to a directory, traverse it

[**-L**](#L)

traverse every symbolic link to a directory encountered

[**-P**](#P)

do not traverse any symbolic links

[**--help**](#help)

display this help and exit

[**--version**](#version)

output version information and exit

# [AUTHOR](#AUTHOR)

Written by Russell Coker and Jim Meyering.

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to: &lt;bug-coreutils@gnu.org&gt;.  
Report any translation bugs to: &lt;https://translationproject.org/team/&gt;.  
GNU coreutils home page: &lt;https://www.gnu.org/software/coreutils/&gt;  
General help using GNU software: &lt;https://www.gnu.org/gethelp/&gt;

# [COPYRIGHT](#COPYRIGHT)

Copyright © 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &lt;https://gnu.org/licenses/gpl.html&gt;.  
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

# [SEE ALSO](#SEE_ALSO)

Full documentation &lt;https://www.gnu.org/software/coreutils/chcon&gt;  
or available locally via: info '(coreutils) chcon invocation'

October 2026 GNU coreutils 9.12

---

Document: chcon(1) from coreutils 9.12-r5 (Chainguard OS)
Source: https://git.savannah.gnu.org/git/coreutils.git
