查看标签
查看标签
ls -Z /var/www/html/ # 文件标签
ls -Zd /var/www/html/ # 目录本身
ps auxZ | grep nginx # 进程标签
id -Z # 当前用户标签临时修改与恢复
临时修改与恢复
chcon -t httpd_sys_content_t /web/index.html
chcon -R -t httpd_sys_content_t /web
restorecon -v /web/index.html # 按策略默认值恢复
restorecon -Rv /web标签格式为 user:role:type:level,targeted 策略下日常关心的是 type(如 httpd_sys_content_t);chcon 改动会被 relabel 覆盖,长期生效用 semanage fcontext 登记规则。