Change user ownership of s3fs mounted buckets - amazon-s3

how can I modify the user:group ownership of a s3fs mounted bucket?
I have a git installation that I would essentially like to store on my Amazon S3 account in a bucket, and then using Sparkleshare, via my web host, sync this data accross multiple machines.
- I Have set up the sparkleshare to successfully sync three machines. Works like a charm.
This is syncing to a folder at /home/git/dropbox No problems there.
I want the sync folder to me a mounted S3 bucket though
I can mount the buckets right next to that dropbox folder, but no love changing ownership to git:git
Problem: when you create the mount with root:root user, only that user has access to the bucket.
I tried to create the mount with S3FS logged in as the GIT user, but no luck, it still mounts and assigns permissions as the root:root user.
Do I uninstall S3FS and re-install using the GIT user?
Any help would be greatly appreciated!
Rick

You simply want to mount it as that user. You can also automount it by adding the uid and gid that you want it mounted as. For example, your /etc/fstab would have an entry such as the following:
s3fs#s3bucketName /mnt/point fuse defaults,noatime,allow_other,uid=500,gid=48,use_cache=/tmp,default_acl=public-read 0 0

On Ubuntu I am finding that whichever user does the s3fs mount will own it, even though ls will show the owner as root:root, and in fact root cannot use it. When you did the mount as the git user are you sure you could not write to it?

1.69 seems to have fixed a uid/gid issue
https://code.google.com/p/s3fs/downloads/detail?name=s3fs-1.69.tar.gz&can=2&q=

Related

Set default permissions for files within directory of mounted S3 Bucket

I have an S3 bucket mounted on my server. It was mounted as root.
I need to make all files within certain folders within the bucket owned by another user by default because when I try to perform operations on that directory as that user, it says access denied.
I tried:
sudo setfacl -Rdm u:newuser:rwx /path/to/directory/
I also unmounted the bucket, then logged in as that user and tried to remount it, but because that user didn't have access to the password file it didn't work either.
Do I have to just give that user permissions on the password file?
Is there any other way to do this? Open to any other solutions.

scp /var/log/httpd on amazon linux

I am trying to do:
scp ec2-user#php-pos-web-1:/var/log/httpd/* tmp/php-pos-web-1;
I get permission denied because those files are owned by root. I don't want to enable root login. Is it ok if I change the group for that folder? What is the best way?
I am on amazon linux
It is generally not a good idea to change the permissions to system folders. They are not world-readable for a reason. They can expose potentially sensitive data (accessed pages, clients IP addresses, ...).
You should on the other way copy the files to some some accessible location (/tmp) using sudo and then copy them over the network back.

Problems reading files from an S3 bucket mounted to Ubuntu using s3fs

I am trying to use sf3f (https://github.com/s3fs-fuse/s3fs-fuse to handle files being uploaded by a different process to an s3 bucket. I can see files listed when I ls in hat mounted directory and the files are showing correctly timestamped and with the correct size. But trying to open the files either in code or using vi or nano just shows garbage such as
^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#
If I curl the s3 link then I do see content so it is available and there do not seem to be permission issues.
I am able to create a new file in this directory and the content is saving fine - can view it in the S3 explorer.
Any thoughts? Is this an s3fs-fuse problem and I may fair better using an alternate such as https://github.com/kahing/goofys?
I have signed up for the AWS EFS preview but no idea what the wait time is for that.

Plex and Owncloud shared folders permission issues

I am setting up a multimedia server on Debian 8.
I installed both Plex and Owncloud. I have set up /var/media as my Owncloud default folder. I decided to create a folder Library at the root of Owncloud. So the folder path is:
/var/media/admin/files/Library
I changed the permissions of media with:
chmod 770 -R /var/media
On top of that, all the files in /var/media are owned by www-data:www-data.
In order to make Plex see my medias, I have added the user plex to the group www-data. I would like to create a library watching my /var/media/admin/files/Library folder but I have a problem, Plex doesn't see neither the files or folders in /var/media. Here is a screenshot:
To finish, I have tried to connect on my server via ssh with the plex user, and it sees files and folders inside /var/media.
What am I doing wrong? Maybe it is not a permission issue?
Thanks
Update
If I change the ownership of /var/media to plex:www-data, it works. But I can't understand why it doesn't work for www-data:www-data. So it is well a permissions issue.
If I launch id plex, I have:
uid=107(plex) gid=33(www-data) groups=33(www-data)
Just to remind, here are the permissions of /var/media folder (full permissions for group...):
drwxrwx--- 4 www-data www-data 4096 Oct 30 09:01 media
I assume from your post that Plex, Linux OS, and your media are all contained on the same machine and that there are no separate computing devices being used here as that would mean additional steps are required.
In all likelyhood, plex won't be able to list your files because the mode 777 is required to list files in a directory even if the files themselves are set more restrictively than 777 e.g. 750. From what I can tell, your chmod command has set all the directory permissions to 770 which would break the listing capability. As it happens I've just yesterday written a guide over on Tech-KnowHow that covers this, and within that I have described how to set all your folders to 777 and your files to something else. That way it works with plex (and other systems for that matter). I've essentially chosen the same solutions as you in that I use the group to assign the permissions and make sure the everyone / other mode is set to apply no permissions.
There's a direct link to the article below, you'll need to click on the implementation page and look for the find command under the 'Apply correct modes' heading. I've also included how to keep your ownership consistent through samba which is useful when copying new files across. Let me know how that goes in the comments and I'll help you out where I can while it's still fresh in my mind. Good luck!
https://www.tech-knowhow.com/2016/03/how-to-plex-permissions-linux/
I know it is an old post, but I had the same issue and this was my solution :
After a
sudo service plexmediaserver status
I found the file used to launch the plex service /lib/systemd/system/plexmediaserver.service. This file contains the user and group which are used by plex.
So we can change the line Group=plex by your group.
PS: do not forget to restart the plex service with
sudo service plexmediaserver restart

s3fs permissions for s3 directory

I'm trying to mount the s3 directory to my EC2 instance. I'm getting everything to work except my user is not able to write to the mounted directory. I even ran with the allow_other permission set. Is there something else?
I created the directory and made sure the permission was there for my current user
I then mounted the s3 bucket using the allow_other option
My user is able to read but not write...
Is there something else I need to do? I read the following sites for this:
https://code.google.com/p/s3fs/issues/detail?id=185
http://xentek.net/articles/448/installing-fuse-s3fs-and-sshfs-on-ubuntu/
http://michaelaldridge.info/post/12086788604/mounting-s3-within-an-ec2-instance
I honestly have no clue what happened. But I restarted my EC2 instance and ran the above again and it worked perfectly.