我有一个相对文件夹'files / crm-upload',我要在其中上传文件。我的代码检查is_writable()是否为true,并且只有在这种情况下才会继续。
该文件夹通过rw和sec = sys作为NFS共享挂载。
我写了一个测试脚本,我也在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
所以:
怎么可能是只有已挂载共享的根文件夹不可写,而其他所有东西都不能写?
这是Ubuntu 18.04。客户端,没有运行SELinux ...
答案 0 :(得分:0)
我认为您没有40777
。我认为您有4777
或0777
使用2777
或7777
有关https://linuxconfig.org/how-to-use-special-permissions-the-setuid-setgid-and-sticky-bits的更多信息