chcon Command Examples

Change SELinux security context of a file or files/directories. See also: secon, restorecon, semanage-fcontext. More information: https://www.gnu.org/software/coreutils/manual/html_node/chcon-invocation.html.

ls {{[-lZ|-l --context]}} {{path/to/file}}

chcon --reference {{reference_file}} {{target_file}}

chcon {{user}}:{{role}}:{{type}}:{{range/level}} {{filename}}

chcon {{[-u|--user]}} {{user}} {{filename}}

chcon {{[-r|--role]}} {{role}} {{filename}}

chcon {{[-t|--type]}} {{type}} {{filename}}

chcon {{[-l|--range]}} {{range/level}} {{filename}}