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

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

问题描述

我正在尝试允许匿名访问桶中的文件(或仅从我的应用程序域访问).

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

尝试读取文件时

```

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

```

我还尝试在Google云控制台中使用对象默认权限对话框添加域.出现错误您的权限之一无效.请确保为组和用户输入授权的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 Access 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天全站免登陆