允许对 GCS 存储桶进行公共读取访问? [英] Allow Public Read access on a GCS bucket?

查看:16
本文介绍了允许对 GCS 存储桶进行公共读取访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试允许对我的存储桶中的文件进行匿名(或仅从我的应用程序域)读取访问.

I am trying to allow anonymous (or just from my applications domain) read access for files in my bucket.

当我试图读取我得到的文件

When trying to read the files I get

```

<Error>
    <Code>AccessDenied</Code>
    <Message>Access denied.</Message>
    <Details>
        Anonymous users does not have storage.objects.get access to object.
    </Details>
</Error>

```

我还尝试在谷歌云控制台中添加一个具有对象默认权限对话框的域.这给了我错误您的一个权限无效.请确保您输入组和用户的授权 ID 或电子邮件以及域的域"

I also tried to add a domain with the object default permissions dialog in the google cloud console. that gives me the error "One of your permissions is invalid. Make sure that you enter an authorized id or email for the groups and users and a domain for the domains"

我还研究了为存储桶 public-read 制作 ACL.我唯一的问题是它删除了我对存储桶的所有权.我需要拥有该所有权,因为我想允许从特定的 Google 访问 ID 上传.

I have also looked into making the ACL for the bucket public-read. My only problem with this is that it removes my ownership over the bucket. I need to have that ownership since I want to allow uploading from a specific Google Access Id.

推荐答案

您可以使用 gsutil 使在存储分区中创建的新对象公开可读,而无需删除您的所有权.要使存储桶中创建的新对象可公开读取:

You can use gsutil to make new objects created in the bucket publicly readable without removing your ownership. To make new objects created in the bucket publicly readable:

gsutil defacl ch -u AllUsers:R gs://yourbucket

如果您希望将存储桶中的现有对象设为公开可读,您可以运行:

If you have existing objects in the bucket that you want to make publicly readable, you can run:

gsutil acl ch -u AllUsers:R gs://yourbucket/**

这篇关于允许对 GCS 存储桶进行公共读取访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆