How to use s4cmd to upload public objects to S3
s3cmd
has a parameter that lets you set public read permissions to objects you upload.
By using s3cmd put --acl-public (...)
or s3cmd put -P (...)
you can upload files and set its permissions to public in one go.
I prefer to use s4cmd
instead, but the documentation is confusing when it comes to setting permissions
--API-ACL=ACL The canned ACL to apply to the object.
--API-GrantFullControl=GRANTFULLCONTROL
Gives the grantee READ, READ_ACP, and WRITE_ACP
permissions on the object.
--API-GrantReadACP=GRANTREADACP
Allows grantee to read the object ACL.
--API-GrantRead=GRANTREAD
Allows grantee to read the object data and its
metadata.
--API-GrantWriteACP=GRANTWRITEACP
Allows grantee to write the ACL for the applicable
So here’s the (very simple) solution:
$ s4cmd put --API-ACL=public-read (...)
Please mind you must have S3::PutObjectACL
permissions to make this work.