提问人:Sentenza 提问时间:2/27/2019 最后编辑:yiviSentenza 更新时间:8/12/2022 访问量:649
is_writable NFS 共享返回 false,即使它对用户 www-data 是可写的
is_writable returns false for NFS-share, even though it is writable for the user www-data
问:
我有一个相对文件夹“files/crm-upload”,我想在其中上传文件。我的代码检查 is_writable() 是否为 true,并且只有在出现这种情况时才会继续。
该文件夹将装载为 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 是正确的
- dir 具有正确的权限
- 共享上的子文件夹和文件的is_writable返回 true
这怎么可能,只有挂载共享的根文件夹是不可写的,而其他一切都是可写的?
它是 ubuntu 18.04。客户端,没有 SELinux 正在运行...
答:
0赞
Andrei Lupuleasa
3/5/2019
#1
我不认为你有.我想你有或40777
4777
0777
使用或2777
7777
查看更多 https://linuxconfig.org/how-to-use-special-permissions-the-setuid-setgid-and-sticky-bits
评论
0赞
Sentenza
3/7/2019
“files/crm-upload”目录下的 ls -lah 显示: .此外,文件权限“40777”是在PHP中使用确定的。drwxrwxrwx 152 www-data www-data 4,0K Feb 27 10:26 .
sprintf('%o', fileperms($dirname))
评论
ls -la