Skip to content

Instantly share code, notes, and snippets.

@unnitallman
Forked from greenantdotcom/s3.markdown
Created June 26, 2018 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unnitallman/b00c74d8f3bf6cd25bb5887343b0078c to your computer and use it in GitHub Desktop.
Save unnitallman/b00c74d8f3bf6cd25bb5887343b0078c to your computer and use it in GitHub Desktop.
Setting public read-only ACL for uploaded files

Alternatively, in the Amazon interface, you can select a directory or file, and click on the action "Mark as public"

###
### When using s3cmd, pass in --acl-public when initially creating the files, and the proper ACL will be set
###
s3cmd sync --acl-public /backups/appimages/tickets/ s3://ares-appimages-production/tickets/
###
### To verify the ACL was successfully set, use `s3cmd info`
###
[ec2-user@ip-10-252-65-126 airlines]$ s3cmd info s3://ares-appimages-production/airlines/99/99/thumbnail
s3://ares-appimages-production/airlines/99/99/thumbnail (object):
File size: 761
Last mod: Wed, 28 Mar 2012 21:46:19 GMT
MIME type: binary/octet-stream
MD5 sum: 4abbe78c7d2fab5059501d14c23ff581
ACL: greenantdotcom: FULL_CONTROL
ACL: *anon*: READ
URL: http://ares-appimages-production.s3.amazonaws.com/airlines/99/99/thumbnail
----
### Alternatively, you can go into the S3 interface in the Amazon console and select a folder and select the action "Make Public" which should do the same thing.
When using s3fs, make sure to set the default acl appropriately:
s3fs#ares-appimages-production /s3mounts/ares-appimages-production fuse use_cache=/tmp,allow_other,uid=222,gid=500,default_acl=public-read 0 0
s3fs#ares-appimages-production-logs /s3mounts/ares-appimages-production-logs fuse use_cache=/tmp,allow_other,uid=222,gid=500,default_acl=public-read 0 0
Wherein the default_acl should be set to public-read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment