【发布时间】:2017-10-24 12:22:38
【问题描述】:
我没有使用 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
【问题讨论】:
-
/home/admin/live_storage/c50d02d942c0a3d.cache文件在您尝试 touch as apache 之前是否存在? -
@DusanBajic 嗨,没有。整个目录是空的
-
[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]#
标签: linux apache permissions chmod selinux