1CHCON(1) User Commands CHCON(1)
2
3
4
6 chcon - change file SELinux security context
7
9 chcon [OPTION]... CONTEXT FILE...
10 chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
11 chcon [OPTION]... --reference=RFILE FILE...
12
14 Change the SELinux security context of each FILE to CONTEXT. With
15 --reference, change the security context of each FILE to that of RFILE.
16
17 Mandatory arguments to long options are mandatory for short options
18 too.
19
20 --dereference
21 affect the referent of each symbolic link (this is the default),
22 rather than the symbolic link itself
23
24 -h, --no-dereference
25 affect symbolic links instead of any referenced file
26
27 -u, --user=USER
28 set user USER in the target security context
29
30 -r, --role=ROLE
31 set role ROLE in the target security context
32
33 -t, --type=TYPE
34 set type TYPE in the target security context
35
36 -l, --range=RANGE
37 set range RANGE in the target security context
38
39 --no-preserve-root
40 do not treat '/' specially (the default)
41
42 --preserve-root
43 fail to operate recursively on '/'
44
45 --reference=RFILE
46 use RFILE's security context rather than specifying a CONTEXT
47 value
48
49 -R, --recursive
50 operate on files and directories recursively
51
52 -v, --verbose
53 output a diagnostic for every file processed
54
55 The following options modify how a hierarchy is traversed when the -R
56 option is also specified. If more than one is specified, only the fi‐
57 nal one takes effect.
58
59 -H if a command line argument is a symbolic link to a directory,
60 traverse it
61
62 -L traverse every symbolic link to a directory encountered
63
64 -P do not traverse any symbolic links (default)
65
66 --help display this help and exit
67
68 --version
69 output version information and exit
70
72 Written by Russell Coker and Jim Meyering.
73
75 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
76 Report any translation bugs to <https://translationproject.org/team/>
77
79 Copyright © 2022 Free Software Foundation, Inc. License GPLv3+: GNU
80 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
81 This is free software: you are free to change and redistribute it.
82 There is NO WARRANTY, to the extent permitted by law.
83
85 Full documentation <https://www.gnu.org/software/coreutils/chcon>
86 or available locally via: info '(coreutils) chcon invocation'
87
88
89
90GNU coreutils 9.1 January 2023 CHCON(1)