Skip to content

Commit f182e39

Browse files
pranlawateManagor
andauthored
setfiles: add page (#18473)
Co-authored-by: Managor <[email protected]>
1 parent 13bc06c commit f182e39

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pages/linux/setfiles.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# setfiles
2+
3+
> Set SELinux file security contexts based on policy rules.
4+
> Similar to `restorecon` but reads contexts from a file_contexts file.
5+
> See also: `restorecon`, `semanage-fcontext`, `fixfiles`.
6+
> More information: <https://manned.org/setfiles>.
7+
8+
- Set file contexts according to the default policy file:
9+
10+
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}}`
11+
12+
- Set file contexts recursively and show changes:
13+
14+
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-v|--verbose]}}`
15+
16+
- Preview what would be changed without actually modifying contexts:
17+
18+
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-n|--nochange]}}`
19+
20+
- Set file contexts and verify them:
21+
22+
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-v|--verbose]}} {{[-F|--force]}}`
23+
24+
- Use a specific root path for context matching:
25+
26+
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/new_directory}} {{[-r|--rootpath]}} {{path/to/old_directory}}`

0 commit comments

Comments
 (0)