Linux command
chcat 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
List
sudo chcat -L
Add
sudo chcat +[CategoryName] [path/to/file]
Remove
sudo chcat -- -[CategoryName] [path/to/file]
Set
sudo chcat [CategoryName1,CategoryName2,...] [path/to/file]
Display
ls -Z [path/to/file]
Remove all
sudo chcat -d [path/to/file]
说明
chcat changes SELinux security categories for files. Categories are part of Multi-Category Security (MCS), providing additional access control beyond traditional SELinux types. MCS categories allow compartmentalization of data, where users or processes can only access files with matching categories.
参数
- -L, --list
- List all available categories
- -d, --delete
- Remove all categories from file
- +_category_
- Add a category
- -_category_
- Remove a category (use -- before)
FAQ
What is the chcat command used for?
chcat changes SELinux security categories for files. Categories are part of Multi-Category Security (MCS), providing additional access control beyond traditional SELinux types. MCS categories allow compartmentalization of data, where users or processes can only access files with matching categories.
How do I run a basic chcat example?
Run `sudo chcat -L` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -L, --list do in chcat?
List all available categories