即使对于用户www-data可写,is_writable对于NFS共享也返回false

Sen*_*nza 5 php linux apache ubuntu nfs

我有一个相对的文件夹'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
Run Code Online (Sandbox Code Playgroud)

所以:

  • 触摸共享上的文件有效
  • uid是正确的
  • 目录具有正确的权限
  • 共享中的子文件夹和文件的is_writable返回true

怎么可能只有已挂载共享的根文件夹不可写,而其他所有东西都不能写?

这是Ubuntu 18.04。客户端,没有运行SELinux ...

And*_*asa 0

我认为你没有40777。我认为你有47770777

使用27777777

有关更多信息,请参阅https://linuxconfig.org/how-to-use-special-permissions-the-setuid-setgid-and-sticky-bits