【发布时间】:2019-07-21 03:04:15
【问题描述】:
我有一个相对文件夹“files/crm-upload”,我想在其中上传文件。我的代码检查 is_writable() 是否为真,只有在这种情况下才会继续。
文件夹作为 NFS 共享挂载为 rw 和 sec=sys。
我已经写了一个测试脚本,我也在apache上执行它来查看访问权限,结果是:
files/crm-upload/php_touch modification time has been changed to present time
My effective UID is 33 but my UID is really 33
files/crm-upload/ is owned by 33 and has permissions 40777
is_readable('files/crm-upload/') gives true
is_readable('files/crm-upload/php_touch') gives true
is_writable('files/crm-upload/') gives false
is_writable('files/crm-upload/php_touch') gives true
is_writable('files/crm-upload/25/') gives true
is_writable('files/images/') gives true
file_exists('files/crm-upload/') gives true
file_exists('files/crm-upload/php_touch') gives true
Some stat uids:
files/crm-upload/: 33
files/crm-upload/php_touch: 33
files/images/: 33
所以:
- 触摸共享上的文件有效
- uid 正确
- 目录具有正确的权限
- is_writable 对于共享上的子文件夹和文件返回 true
这怎么可能,只有挂载共享的根文件夹不可写,其他的都是可写的?
这是一个 ubuntu 18.04。客户端,没有运行 SELinux...
【问题讨论】:
-
那个文件夹的完整路径是什么?
-
@AndreiLupuleasa /var/www/html/iah/files/crm-upload
-
根文件夹是指哪个文件夹?
-
@AndreiLupuleasa crm-upload 文件夹
-
你能在上面做一个
ls -la吗?
标签: php linux apache ubuntu nfs