mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-13 20:59:32 +00:00
Update cheatsheets
This commit is contained in:
30
linux/semanage-fcontext
Normal file
30
linux/semanage-fcontext
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# semanage fcontext
|
||||
|
||||
> Manage persistent SELinux security context rules on files/directories.
|
||||
> See also: `semanage`, `restorecon`.
|
||||
> More information: <https://manned.org/semanage-fcontext>.
|
||||
|
||||
- List all file labelling rules:
|
||||
|
||||
`sudo semanage fcontext --list`
|
||||
|
||||
- List all user-defined file labelling rules without headings:
|
||||
|
||||
`sudo semanage fcontext --list --locallist --noheading`
|
||||
|
||||
- Add a user-defined rule that labels any path which matches a PCRE regex:
|
||||
|
||||
`sudo semanage fcontext --add --type {{samba_share_t}} {{'/mnt/share(/.*)?'}}`
|
||||
|
||||
- Delete a user-defined rule using its PCRE regex:
|
||||
|
||||
`sudo semanage fcontext --delete {{'/mnt/share(/.*)?'}}`
|
||||
|
||||
- Relabel a directory recursively by applying the new rules:
|
||||
|
||||
`restorecon -R -v {{path/to/directory}}`
|
||||
Reference in New Issue
Block a user