简体   繁体   English

其他人在我的 AWS S3 存储桶中创建的对象的访问权限被拒绝

[英]Access permission denied for the objects created by someone else in my AWS S3 bucket

We have an application that writes files to an Amazon S3 bucket.我们有一个将文件写入 Amazon S3 存储桶的应用程序。 I am not able to download or copy the files to different bucket.我无法将文件下载或复制到不同的存储桶。 I am getting access denied error.我收到access denied错误。 The owner of the file is someone else but the bucket is owned by us.文件的所有者是其他人,但存储桶归我们所有。 That person is not accessible and is not there in the organization.该人不可访问,也不存在于组织中。 How do I access the files and change the access permission or change the owner of the files?如何访问文件并更改访问权限或更改文件的所有者?

I tried copying the objects from source bucket to destination bucket but Error 403 .我尝试将对象从源存储桶复制到目标存储桶,但出现Error 403

Here is the bucket policy:这是存储桶策略:

{
    "Version": "2012-10-17",
    "Id": "abcd",
    "Statement": [
        {
            "Sid": "abcd",
            "Effect": "Allow",
            "Principal": {
                "AWS": [
                    "arn:aws:iam::123456789012:user/xxx"
                ]
            },
            "Action": [
                "s3:GetObject",
                "s3:GetBucketLocation",
                "s3:ListBucket",
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::xyz/*",
                "arn:aws:s3:::xyz"
            ]
        }
    ]
} 

Expected: I want to move these files to different bucket or download these files.预期:我想将这些文件移动到不同的存储桶或下载这些文件。 It is giving error Access denied 403 .它给出错误Access denied 403

The uploader of the files needs to grant full control over the objects to the bucket owner.文件的上传者需要将对象的完全控制权授予存储桶所有者。

How you do this depends on which tool or SDK you are using to upload files.如何执行此操作取决于您用于上传文件的工具或 SDK。 For example, if you are using the awscli then you would append --acl bucket-owner-full-control to the aws s3 cp command.例如,如果您使用的是awscli ,那么您将 append --acl bucket-owner-full-controlaws s3 cp命令。

As an S3 bucket owner, you can require uploaders to give you full control by specifying an appropriate S3 bucket policy.作为 S3 存储桶所有者,您可以通过指定适当的 S3 存储桶策略来要求上传者为您提供完全控制权

Note that giving the bucket owner full control does not make the bucket owner the owner of the objects.请注意,授予存储桶拥有者完全控制权并不会使存储桶拥有者成为对象的拥有者。 They are still owned by the uploader.它们仍归上传者所有。 However, if the bucket owner has full control and wants ownership, then the bucket owner can simply copy each file over itself, and that will transfer the ownership.但是,如果存储桶拥有者拥有完全控制权并想要拥有所有权,那么存储桶拥有者可以简单地将每个文件复制到自身之上,这将转移所有权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM