Chinaunix首页 | 论坛 | 博客
  • 博客访问: 326054
  • 博文数量: 97
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 811
  • 用 户 组: 普通用户
  • 注册时间: 2015-02-25 19:22
文章分类

全部博文(97)

文章存档

2021年(1)

2020年(18)

2019年(14)

2018年(29)

2017年(16)

2016年(19)

我的朋友

分类: 系统运维

2017-10-18 17:30:56

1.一般无法在某目录写入时,要检查写入权限
chmod 777来确认是否是这个问题
2.如果还不行就要selinux fcontext的问题了
这里我主要针对apache web应用,所以检查apache的context了

apache的context种类
httpd_sys_content_t Read-only directories and files used by Apache
httpd_sys_rw_content_t Readable and writable directories and files used by Apache. Assign this to directories where files can be created or modified by your application, or assign it to files directory to allow your application to modify them.
httpd_log_t Used by Apache to generate and append to web application log files.
httpd_cache_t Assign to a directory used by Apache for caching, if you are using mod_cache.
在检查前要先ls -Z 确认是否有目录写权限,和是否有安装semanage命令
yum install -y policycoreutils-python 安装semanage命令

semanage命令
选项 -l:查询。
fcontext:主要用在安全上下文方面。
-a:增加,你可以增加一些目录的默认安全上下文类型设置。
-m:修改。
-d:删除。

# semanage fcontext -a -t httpd_sys_rw_content_t “/webroot(/.*)?"
# restorecon -Rv "/webroot(/.*)?"  保存修改

最后在看看是否有写入权限
# ls -lZ /webroot
阅读(856) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~