0

我正在运行一个谷歌计算实例,它必须能够连接到读取和写入本地安装的存储桶。

目前,当 ssh-ed 进入机器时,我有权读取目录中的所有文件,但不能写入它们。

这里有更多细节:

gcloud init
account: PROJECT_NUMBER-compute@developer.gserviceaccount.com

在 google 平台上查看 IAM 时,这个 IAM 具有专有角色,因此它应该能够访问项目中的所有资源。

gcsfuse -o allow_other --file-mode 777 --dir-mode 777 --o nonempty BUCKET LOCAL_DIR

现在查看权限,所有文件都有(如预期的那样)

ls -lh LOCAL_DIR/
drwxrwxrwx 1 ubuntu ubuntu 0 Jul  2 11:51 folder

但是,当运行一个非常简单的 python 代码将泡菜保存到这些目录之一时,我收到以下错误

OSError: [Errno 5] Input/output error: FILENAME

如果我使用 --foreground 标志运行 gcsuse,它产生的错误是

fuse: 2018/07/02 12:31:05.353525 *fuseops.GetXattrOp error: function not implemented
fuse: 2018/07/02 12:31:05.362076 *fuseops.SetInodeAttributesOp error: SetMtime: \
UpdateObject: googleapi: Error 403: Insufficient Permission, insufficientPermissions

这很奇怪,因为 VM 上的帐户具有专有角色。

关于如何克服这个问题的任何猜测?

4

1 回答 1

1

您的实例需要适当的范围才能访问 GCS 存储桶。您可以通过控制台或使用 gcloud compute instances describe [instance_name] | 查看范围。grep 范围 -A 10

您必须有存储读/写或https://www.googleapis.com/auth/devstorage.read_write

于 2018-07-27T17:21:57.277 回答