Apache用户无法在777目录中创建文件

3

我没有使用SELinux,但是我仍然无法让Apache用户在我的缓存存储目录中创建文件。如果不使用chown更改用户为实际的Apache用户,这种情况能行得通吗?

[root@server live_storage]# getenforce
Disabled
[root@server live_storage]# su -s /bin/bash -c 'touch /home/admin/live_storage/c50d02d942c0a3d.cache' apache
touch: cannot touch ‘/home/admin/live_storage/c50d02d942c0a3d.cache’: 
Permission denied
[root@server admin]# ls -lsa 
total 84 
  4 drwx------. 10 admin admin  4096 24 mei 10:32 .
  4 drwxr-xr-x.  3 root  root   4096  9 mei 11:12 ..
  4 drwxrwxrwx   3 admin admin  4096 24 mei 10:33 live_storage

[admin@server live_storage]$ touch '/home/admin/live_storage/c50d02d942c0a3d.cache'
[admin@server live_storage]$ ls '/home/admin/live_storage/c50d02d942c0a3d.cache'
/home/admin/live_storage/c50d02d942c0a3d.cache

在尝试以 Apache 的身份执行 touch 命令之前,/home/admin/live_storage/c50d02d942c0a3d.cache 文件是否已存在? - Dusan Bajic
@DusanBajic 你好,没有。整个目录都是空的。 - JuNijland
[root@server live_storage]# su -s /bin/bash -c 'touch /home/admin/live_storage//c50d02d942c0a3d.cache' touch: cannot touch ‘/home/admin/live_storage//c50d02d942c0a3d.cache’: Permission denied [root@server live_storage]# su -s /bin/bash -c 'touch /home/admin/live_storage//c50d02d942c0a3d.cache' admin [root@server live_storage]# - JuNijland
1个回答

1

问题解决了。Apache在/home/admin目录下没有执行权限。chmod +x /home/admin修复了这个问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接