使用gcsfuse作为Google计算实例上的非root用户的权限错误

目前,我们正在尝试为一些需要大量存储的工作负载演示Google云平台。 我们正在尝试使用谷歌云存储,但使用gcsfuse挂载桶时遇到问题。 我目前能够以root用户身份(使用allow_other选项设置)挂载我的testing存储桶,但非root用户只能读取权限。

我试过并检查过的东西:

  • 将安装点设置为777.当安装存储桶时,权限将被覆盖。
  • 用户显示在gcloud config list | grep account gcloud config list | grep account已被授予此存储桶的所有者访问权限
  • 我正在testing的虚拟机具有对所有Google云服务的完整API访问权限

这里是控制台输出 – 捕捉并触摸animal.txt来更新时间戳。

 root@vm-00 cloud]# grep bucket /etc/fstab test_bucket_00 /data/cloud/tb-00 gcsfuse rw,allow_other [root@vm-00 cloud]# mount tb-00 Calling gcsfuse with arguments: -o rw -o allow_other test_bucket_00 /data/cloud/tb-00 Using mount point: /data/cloud/tb-00 Opening GCS connection... Opening bucket... Mounting file system... File system has been successfully mounted. [root@vm-00 cloud]# mount | grep bucket test_bucket_00 on /data/cloud/tb-00 type fuse (rw,nosuid,nodev,allow_other,default_permissions) [root@vm-00 cloud]# ls -lh /data/cloud/tb-00/animal.txt ; date ; touch/data/cloud/tb-00/animal.txt ; ls -lh /data/cloud/tb-00/animal.txt -rw-r--r--. 1 root root 20 Jan 21 00:24 /data/cloud/tb-00/animal.txt Thu Jan 21 00:25:37 UTC 2016 -rw-r--r--. 1 root root 20 Jan 21 00:25 /data/cloud/tb-00/animal.txt [root@vm-00 cloud]# cat /data/cloud/tb-00/animal.txt ants bats cats dogs [root@vm-00 cloud]# ls -lh /data/cloud total 4.0K drwxr-xr-x. 1 root root 0 Jan 21 00:25 tb-00 [root@vm-00 cloud]# chmod 777 /data/cloud/tb-00 [root@vm-00 cloud]# ls -lh /data/cloud total 4.0K drwxr-xr-x. 1 root root 0 Jan 21 00:25 tb-00 [root@vm-00 cloud]# gcloud config list Your active configuration is: [NONE] [core] account = [email protected] disable_usage_reporting = True project = testing1-1148 [root@vm-00 cloud]# 

现在作为非root用户,我能够看到animal.txt的内容,但是我无法触摸该文件或在该目录中创build一个新文件。 :

 [testuser@vm-00 ~]$ cat /data/cloud/tb-00/animal.txt ants bats cats dogs [testuser@vm-00 ~]$ touch /data/cloud/tb-00/mineral.txt touch: cannot touch `/data/cloud/tb-00/mineral.txt': Permission denied [testuser@vm-00 ~]$ gcloud config list Your active configuration is: [NONE] [core] account = [email protected] disable_usage_reporting = True project = testing1-1148 

是gcsfuse正确的方式去做这个还是有一个更好的解决scheme,以安装在全系统级别上可用的谷歌云存储桶? 我知道这些文档说不要以root身份挂载这个桶,但是我没有看到任何解释它为什么不好的东西。 我试图以非root用户身份login,但即使在用户被添加到保险丝组后,我也遇到了许可问题。 我不确定这是否与我的问题有关,但是一旦我得到这个工作,我会深入挖掘。

644755是gcsfuse文件系统中所有文件和目录inode的默认权限。 您可以使用--file-mode--dir-mode标志来控制它们。 看到这里的文件。

要使用echdee的示例创buildfstab条目,请使用下划线指定gcsfuse目录模式和文件模式属性:

 test_bucket_00 /data/cloud/tb-00 gcsfuse rw,allow_other,file_mode=777,dir_mode=777 

https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/docs/mounting.md