title: Setting owner of objects in an S3 bucket
body: <p>I have been experimenting with S3 and they have this cool feature where you can set ACL's on the content of a bucket through a bucket policy. So for instance you can have a bunch of files with the actual ACL on the file set to private but the file is made available to certain users / ip addresses / referrers through the overriding policy.</p>
  
  <p>In my case I have a bunch of private content in a bucket but I want to make the files in a particular directory available to my site (e.g. Images). So I have something like this:</p>
  
  <pre><code>{
      "Version": "2008-10-17",
      "Id": "",
      "Statement": [
          {
              "Sid": "AddPerm",
              "Effect": "Allow",
              "Principal": {
                  "AWS": "*"
              },
              "Action": "s3:GetObject",
              "Resource": "arn:aws:s3:::content-racket-fm/uploaded/images/*"
          }
      ]
  }
  </code></pre>
  
  <p>Now we have some background I can get to the question. I recently found out here:</p>
  
  <p><a href="https://forums.aws.amazon.com/thread.jspa?threadID=78294" rel="noreferrer">https://forums.aws.amazon.com/thread.jspa?threadID=78294</a></p>
  
  <p>That bucket policies only work for files that are <strong>owned</strong> by the bucket owner. So for instance if the files ended up in the bucket through some external service like encoding.com or panda stream where they have their own user on your S3 bucket, you're going to have problems because your bucket policy won't be applied to these files (that seems like an oversight by amazon in my opinion but I am sure there is a good reason I haven't thought of)</p>
  
  <p>I am using rails, is there a way to set the owner of an object in a bucket.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I guess a better question might be... </p>
  
  <p>Is there a way to setup an amazon bucket so it applies bucket policy to all files regardless of owner.</p>