美文网首页
配置SELinux

配置SELinux

作者: Dove_Q | 来源:发表于2016-11-16 19:03 被阅读272次

/etc/selinux/config中selinux默认是打开的,改为disabled是关闭

创建SELinux策略

安装semanage命令:

 # yum install -y policycoreutils-python setroubleshooting
  1. /websites目录以及所有子目录和文件设置httpd_sys_content_t上下文策略
#semanage fcontext -a -t httpd_sys_content_t "/websites(/.*)?"
  1. 给日志目录设置httpd_log_t上下文策略权限
#semanage fcontext -a -t httpd_log_t "/websites/logs(/.*)?"
  1. 给缓存目录设置httpd_cache_t上下文策略权限
#semanage fcontext -a -t httpd_cache_t "/websites/cache(/.*)?"
  1. 使其生效
#restorecon -Rv /websites

可以用ls -lz查看

也可以直接用chcon -R -t httpd_sys_rw_content_t 文件目录路径修改

相关文章

网友评论

      本文标题:配置SELinux

      本文链接:https://www.haomeiwen.com/subject/xwvrpttx.html