gpt4 book ai didi

php - is_writable 为 NFS-share 返回 false,即使它对用户 www-data 是可写的

转载 作者:IT王子 更新时间:2023-10-29 00:42:46 25 4
gpt4 key购买 nike

我有一个相对文件夹“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...

最佳答案

我不认为你有 40777。我想你有 47770777

使用 27777777

查看更多信息 https://linuxconfig.org/how-to-use-special-permissions-the-setuid-setgid-and-sticky-bits

关于php - is_writable 为 NFS-share 返回 false,即使它对用户 www-data 是可写的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54904676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com