Amazon has [deprecated ACLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html)
> A majority of modern use cases in Amazon S3 no longer require the use of ACLs, and we recommend that you disable ACLs except in unusual circumstances where you need to control access for each object individually. With Object Ownership, you can disable ACLs and rely on policies for access control. When you disable ACLs, you can easily maintain a bucket with objects uploaded by different AWS accounts. You, as the bucket owner, own all the objects in the bucket and can manage access to them using policies.
They are encouraging everyone to [migrate to bucket policies](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-ownership-migrating-acls-prerequisites.html) instead.
But if such a bucket is public (meaning: write needs credentials, reads are open to the world):
* `public=yes` causes `git annex copy --to` to always set an ACL, which fails, which fails the entire upload
* But setting `public=no` causes `publicurl` to be ignored by `git annex copy --from`, failing the download
#### Feature Request
* If `public=yes`, instead of trying to set an ACL, first try `HTTP HEAD` on the newly uploaded object without using the AWS credentials. Only if that fails, fall over to trying to set an ACL using credential. And if you get AccessControlListNotSupported (i.e. the error due to BucketOwnerEnforced), then give a warning that the bucket policy is not configured for public access.
* Make `publicurl` orthogonal to `public`: if set, `git annex copy --from` should _always_ use it unconditionally.
* Update [the docs here](https://git-annex.branchable.com/special_remotes/S3/) to explain how to set up a public bucket policy as recommended by Amazon, and that `public=yes` will either try to confirm that the bucket policy is public, or will fallback to using (legacy) ACLs.
### What steps will reproduce the problem?
In a bucket I run, I reset the ACLs on that bucket to Amazon's default permissions:
* Bucket owner (your AWS account):
* Objects:
* List
* Write
* Bucket ACL (i.e. what ACLs are applied by default to all objects):
* Read
* Write
and with that set Amazon let me also set
> Object ownership: Bucket owner enforced
This should be the **default configuration** for any new bucket created now, so you only need to do the above if you're migrating an existing bucket like I was; for reproducing, just creating an empty bucket should be enough.