rvabdn
rvabdn

Reputation: 967

s3 change permissions recursively

I have an s3 bucket that contains hundreds of files within subfolders. I know that a small number of those files have public read permissions but I don't know which files they are.

I'd like to remove those permissions from all files so I need to either apply a new set of permissions recursively to all files in the bucket or list all files with public read permissions.

Upvotes: 0

Views: 919

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269340

You can copy the files to themselves (that is, overwrite themselves) while changing permissions.

It might involve adding a small change (eg adding some metadata) to allow the copy to happen:

aws s3 cp s3://my-bucket/ s3://my-bucket/ --recursive --acl bucket-owner-full-control --metadata "One=Two"

See: Amazon S3 File Permissions, Access Denied when copied from another account

Upvotes: 1

Related Questions