授予经过身份验证的用户组对文件的读取权限

发布于 2024-12-28 08:35:51 字数 465 浏览 1 评论 0 原文

如何向经过身份验证的用户组授予文件的读取权限?我正在使用 s3cmd 并且想在上传时执行此操作,但我只是直接关注更改 acl。我应该为 http://acs.amazonaws.com/groups/global/AuthenticatedUsers?我已经尝试了所有可能的 AuthenticatedUsers 组合。

./s3cmd setacl --acl-grant=read:http://acs.amazonaws.com/groups/global/AuthenticatedUsers s3://桶/文件

./s3cmd setacl --acl-grant=读取:AuthenticatedUsers s3://桶/文件

How do I grant read access to the Authenticated Users group for a file? I'm using s3cmd and want to do it while uploading but I'm just focusing directly on changing the acl. What should I put in for http://acs.amazonaws.com/groups/global/AuthenticatedUsers? I have tried every combination of AuthenticatedUsers possible.

./s3cmd setacl
--acl-grant=read:http://acs.amazonaws.com/groups/global/AuthenticatedUsers
s3://BUCKET/FILE

./s3cmd setacl
--acl-grant=read:AuthenticatedUsers
s3://BUCKET/FILE

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

薯片软お妹 2025-01-04 08:35:51

这对于 s3cmd 来说似乎是不可能的。相反,我必须切换到 aws cli 工具。

以下是安装它们的说明:
http://docs.aws.amazon.com/cli/latest/userguide /installing.html

可以使用以下命令将 acl 设置为由经过身份验证的用户在上传过程中读取:

aws s3 cp <file-to-upload> s3://<bucket>/ --acl authenticated-read

加上一整套其他组合,您可以在此处查看:
http://docs.aws.amazon .com/cli/latest/reference/s3/index.html#cli-aws-s3

This doesn't seem to be possible with s3cmd. Instead I had to switch to the aws cli tools.

Here are the directions to install them:
http://docs.aws.amazon.com/cli/latest/userguide/installing.html

It's possible to set the acl to read by authenticated users during upload with the command:

aws s3 cp <file-to-upload> s3://<bucket>/ --acl authenticated-read

Plus a whole load of other combinations you can check out here:
http://docs.aws.amazon.com/cli/latest/reference/s3/index.html#cli-aws-s3

追星践月 2025-01-04 08:35:51

以下命令适用于 s3cmd 版本 1.6.0:
s3cmd setacl s3://<存储桶>/<文件名> --acl-grant='read:http://acs.amazonaws.com/groups/global/AuthenticatedUsers' 对于单个文件。

<代码>
s3cmd setacl s3://<存储桶>/<目录名称> --acl-grant='读取:http://acs.amazonaws.com/groups/global/AuthenticatedUsers' --recursive
用于目录中的所有文件。

The following command works for me with s3cmd version 1.6.0:
s3cmd setacl s3://<bucket>/<file-name> --acl-grant='read:http://acs.amazonaws.com/groups/global/AuthenticatedUsers' for an individual file.


s3cmd setacl s3://<bucket>/<dir-name> --acl-grant='read:http://acs.amazonaws.com/groups/global/AuthenticatedUsers' --recursive
for all files in a directory.

三人与歌 2025-01-04 08:35:51

这是来自 http://s3tools.org/s3cmd

上传文件到存储桶 ~$ s3cmd put addressbook.xml
s3://logix.cz-test/addrbook.xml 文件“addressbook.xml”存储为
s3://logix.cz-test/addrbook.xml (123456 字节) ACL 注意事项
(访问控制列表)—上传到 Amazon S3 存储桶的文件可以
要么是私有的,只有您(拥有者)可读
访问密钥和秘密密钥,或公开的,任何人都可读。每个文件
作为公开上传的文件不仅可以使用 s3cmd 访问,而且还具有
HTTP 地址、URL,可以像任何其他 URL 一样使用
例如通过网络浏览器访问。

<块引用>

~$ s3cmd put --acl-public --guess-mime-type storage.jpg
s3://logix.cz-test/storage.jpg 文件“storage.jpg”存储为
s3://logix.cz-test/storage.jpg(33045 字节)公共 URL
对象是: http://logix.cz-test.s3.amazonaws.com/存储.jpg

现在任何人都可以在浏览器中显示 storage.jpg 文件。很酷,嗯?

尝试将公共更改为经过身份验证,这应该可行。

请参阅 http://docs.amazonwebservices.com/AmazonS3/latest/dev/ ACLOverview.html#CannedACL
它解释了亚马逊方面如何使用他们的 ACL,假设如果您在 s3cmd 中使用 public - 这将在亚马逊中转换为 public-read,因此经过身份验证应转换为 authenticated-read >。

This is from http://s3tools.org/s3cmd:

Upload a file into the bucket ~$ s3cmd put addressbook.xml
s3://logix.cz-test/addrbook.xml File 'addressbook.xml' stored as
s3://logix.cz-test/addrbook.xml (123456 bytes) Note about ACL
(Access control lists) — a file uploaded to Amazon S3 bucket can
either be private, that is readable only by you, possessor of the
access and secret keys, or public, readable by anyone. Each file
uploaded as public is not only accessible using s3cmd but also has a
HTTP address, URL, that can be used just like any other URL and
accessed for instance by web browsers.

~$ s3cmd put --acl-public --guess-mime-type storage.jpg
s3://logix.cz-test/storage.jpg File 'storage.jpg' stored as
s3://logix.cz-test/storage.jpg (33045 bytes) Public URL of the
object is: http://logix.cz-test.s3.amazonaws.com/storage.jpg

Now anyone can display the storage.jpg file in their browser. Cool, eh?

try changing public to authenticated and that should work.

see http://docs.amazonwebservices.com/AmazonS3/latest/dev/ACLOverview.html#CannedACL
it explains on amazon side how to use their ACLs, supposedly if you use public in s3cmd - this would translate to public-read in amazon, so authenticated should translate to authenticated-read.

み零 2025-01-04 08:35:51

如果您愿意使用 Python,boto 库提供了获取和设置 ACL 的所有功能;来自 boto S3 文档

b.set_acl('public-read')

其中 b 是存储桶。当然,在您的情况下,您应该将“public-read”更改为“authenticated-read”。您可以对密钥(文件)执行类似的操作。

If you're willing to use Python, the boto library provides all the functionality to get and set an ACL; from the boto S3 documentation:

b.set_acl('public-read')

Where b is a bucket. Of course in your case you should change 'public-read' to 'authenticated-read'. You can do something similar for keys (files).

故事未完 2025-01-04 08:35:51

如果您想在存储桶级别执行此操作,可以执行 -

aws s3api put-bucket-acl --bucket bucketname --grant-full-control uri=http://acs.amazonaws.com/groups/global/AuthenticatedUsers

文档 - http://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-acl.html

If you want to do it at bucket level you can do -

aws s3api put-bucket-acl --bucket bucketname --grant-full-control uri=http://acs.amazonaws.com/groups/global/AuthenticatedUsers

Docs - http://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-acl.html

浴红衣 2025-01-04 08:35:51

以下是一个示例命令,它将 S3 对象上的 ACL 设置为“authenticated-read”。

aws s3api put-object-acl --acl authenticated-read --bucket mybucket --key myfile.txt

Here is an example command that will set the ACL on an S3 object to authenticated-read.

aws s3api put-object-acl --acl authenticated-read --bucket mybucket --key myfile.txt

.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文