is_writable返回NFS共享的false,即使用户www-data可以写入

9

我有一个名为'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

所以:
  • 在共享文件上触摸可以工作
  • UID 正确
  • dir 有正确的权限
  • 对于共享中的子文件夹和文件,is_writable 返回 true
如何才能出现这种情况,即挂载的共享根文件夹是不可写的,而其他所有内容都可以写入?
这是一个 Ubuntu 18.04 客户端,没有运行 SELinux ...

@AndreiLupuleasa /var/www/html/iah/files/crm-upload - Sentenza
你所说的根文件夹是指哪个文件夹? - Andrei Lupuleasa
@AndreiLupuleasa crm-upload文件夹 - Sentenza
1
你能在它上面运行一个 ls -la 命令吗? - Andrei Lupuleasa
files/crm-upload/ 是由33所有并具有权限40777。您需要哪些信息? - Sentenza
显示剩余2条评论
1个回答

0

在目录“files/crm-upload”上运行“ls -lah”命令,显示如下: drwxrwxrwx 152 www-data www-data 4,0K Feb 27 10:26 .此外,使用PHP中的sprintf('%o', fileperms($dirname))确定了文件权限为“40777”。 - Sentenza

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接