简体   繁体   English

AWS S3 存储桶文件夹文件和子文件夹使用 php 授予公共权限

[英]AWS S3 bucket folder files and sub folder give public permission using php

I want to give the public permission to recursive to all the files of folder using AWS SDK.我想授予公众使用 AWS SDK 递归到文件夹的所有文件的权限。

for example例如

Bucket name: media folder: images/2020-04存储桶名称:媒体文件夹:images/2020-04

I want to make 2020-04 make public.我想让 2020-04 公之于众。 such we give using这样我们给使用

sudo chmod -R 0777 images/2020-04

You can use this policy to only grant access to images/2020-04您可以使用此策略仅授予对images/2020-04

{
 "Version":"2012-10-17",
 "Statement":[
  {
   "Sid":"S1",
   "Effect":"Allow",
   "Principal": "*",
   "Action": "s3:*",
   "Resource":["arn:aws:s3:::your-bucket-name/images/2020-04/*"]
   }
  ]
}

You need to attach this policy to the bucket.您需要将此策略附加到存储桶。

Note: replace your-bucket-name with your bucket's name.注意:将your-bucket-name替换为您的存储桶名称。

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

相关问题 AWS S3 Bucket 将特定文件夹及其中的所有文件设为公开 - AWS S3 Bucket make specific folder and all files in it public 使用 AWS PHP SDK 列出 AWS S3 存储桶内文件夹(前缀)中的所有文件 - List all files within a folder (prefix) inside an AWS S3 Bucket using the AWS PHP SDK AWS - S3从bucket->文件夹PHP获取对象 - AWS - S3 get objects from bucket->folder PHP 使用PHP上传到存储桶中的AWS S3'文件夹' - Upload to AWS S3 'folder' inside bucket with PHP 从s3 bucket php删除包含文件的文件夹 - Delete folder that contains files from s3 bucket php PHP AWS S3 sdk:如何生成预签名的URL以使用PHP将文件上传到S3存储桶中的文件夹? - PHP AWS S3 sdk: How to generate pre signed url to upload a file to a folder in the S3 bucket using PHP? 使用php将文件从一个文件夹复制到Amazon S3存储桶中的另一个文件夹 - Copying files from one folder to another in Amazon S3 bucket using php 如何使用PHP在S3存储桶中创建文件夹 - How to create a folder within S3 bucket using PHP 使用PHP将整个文件夹上传到Amazon S3存储桶 - Upload entire folder to Amazon S3 bucket using PHP 如何在PHP中将所有文件(不使用副本)和文件夹从一个文件夹移动到S3存储桶的另一个文件夹,不能使用复制功能 - How to move all files (without using copy) and folder from one folder to another of S3 bucket in PHP ,Cannot use copy function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM