Mount S3 (s3fs) on EC2 with dynamic files - Persistent Public Permission

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 09:31:48

In my php script that PUT files to S3 using AWK SDK for PHP, I had to add in the meta data, as shown below, which did the trick:

$response = $s3->create_object('bucketname', 'mountpoint/'.$filename, array(
    'body'  => $json_data,
    'contentType' => 'application/json',
    'acl' => AmazonS3::ACL_PUBLIC,
    'meta' => array(
        'mode'         => '33188',    // x-amz-meta-mode
    )
));

The mode "33188" defined the permissions "rw-r--r--" instead of "---------" in S3 bucket (but reflected only in the EC2 mounted folder), which was later inherited by the EC2 mounted drive.

Hope this helps someone. Let me know!

ratm

s3fs#[bucketname] [mountpoint] fuse defaults,noatime,allow_other,uid=222,gid=48,use_cache=/tmp,default_acl=public-read 0 0

For me this line work wihtout setting x-amz-meta-mode! take care of : uid=222 is for my server ec2-user and gid=48 is for my server apache group.

All the script php is executed with apache group. That's why i think you need to put the gid to 48.

see also Change user ownership of s3fs mounted buckets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!