大网数据广告活动
Linux 与通用命令

semanage · 常用命令示例

· 52CE 我爱测

SELinux persistent policy management tool. > Some subcommands such as `boolean`, `fcontext`, `port`, etc. have their own usage documentation. > More information: <https://manned.org/semanage>.

semanage

SELinux persistent policy management tool. Some subcommands such as boolean, fcontext, port, etc. have their own usage documentation. More information: https://manned.org/semanage.

  • Set or unset a SELinux boolean. Booleans allow the administrator to customize how policy rules affect confined process types (a.k.a domains):

sudo semanage boolean

  • Add a user-defined file context labeling rule. File contexts define what files confined domains are allowed to access:

sudo semanage fcontext '/mnt/share(/.*)?'

  • Add a user-defined port labeling rule. Port labels define what ports confined domains are allowed to listen on:

sudo semanage port

  • Set or unset permissive mode for a confined domain. Per-domain permissive mode allows more granular control compared to setenforce:

sudo semanage permissive

  • Output local customizations in the default store:

sudo semanage export

  • Import a file generated by semanage export into local customizations (CAREFUL: may remove current customizations!):

sudo semanage import

来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
tldr-pages contributors
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。