setfiles
linux
Set SELinux file security contexts based on policy rules. Similar to `restorecon` but reads contexts from a file_contexts file. See also: `restorecon`, `semanage-fcontext`, `fixfiles`.
More info →Options (4)
-v, --verbosebooleanSet file contexts recursively and show changes
Example:
sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-v|--verbose]}}-n, --nochangebooleanPreview what would be changed without actually modifying contexts
Example:
sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-n|--nochange]}}-F, --forcebooleanSet file contexts and verify them
Example:
sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-v|--verbose]}} {{[-F|--force]}}-r, --rootpathbooleanUse a specific root path for context matching
Example:
sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/new_directory}} {{[-r|--rootpath]}} {{path/to/old_directory}}Examples (5)
Set file contexts according to the default policy file
Set file contexts recursively and show changes
Preview what would be changed without actually modifying contexts
Set file contexts and verify them
made by @shridhargupta | data from tldr-pages