Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mount as user at startup using fstab #135

Closed
clintcan opened this issue Oct 23, 2015 · 9 comments
Closed

Mount as user at startup using fstab #135

clintcan opened this issue Oct 23, 2015 · 9 comments

Comments

@clintcan
Copy link

Hi,

In the documentation, it is written (for fstab):
my-bucket /mount/point gcsfuse rw,noauto,user

I tried removing noauto to make it mount at start. This doesn't work. How can I edit fstab in such a way that it mounts the bucket with a specified user id?

@jacobsa
Copy link
Contributor

jacobsa commented Oct 26, 2015

You can probably set the allow_other fuse option and appropriately set the --uid and --gid flags to gcsfuse. I would need more detail than "this doesn't work" to know for sure though.

Still: let me urge you to not do this. Requests to GCS are not nearly as reliable as local disk, and you're likely to find yourself with a system that hangs on boot if anything goes wrong.

@clintcan
Copy link
Author

Hi jacobsa,

What I meant was placing in fstab the following (assuming I do not allow on boot):

my-bucket /mount/point gcsfuse rw,uid=www-data,gid=www-data,allow_other,noauto

When I do the mount /mount/point command, it fails with an exit code of 1.

I can do the alternative gcsfuse -o allow_other --uid=n --gid=n my-bucket /mount/point with no problems, but I prefer placing it in fstab so that I can just call mount directly.

@jacobsa
Copy link
Contributor

jacobsa commented Oct 26, 2015

I see, thanks. uid and gid aren't supported in fstab currently. But I'm not sure why you need them. Can you do this

my-bucket /mount/point gcsfuse rw,noauto,user

and then just run the mount command as www-data?

@clintcan
Copy link
Author

Ok, the original purpose was to let a user for example root mount the /mount/point with a specific user assigned to that directory. Anyways, that works for the meantime. Thanks!

@jacobsa
Copy link
Contributor

jacobsa commented Oct 27, 2015

Sounds good. Keep in mind that you can do this as root using sudo -u some_user.

@jacobsa jacobsa closed this as completed Oct 27, 2015
@guocb
Copy link

guocb commented Jan 20, 2017

Sorry to re-open the discussion about this. But the above comments doesn't answer the question, i.e. mount the bucket when system boot up automatically. Absolutely we can create a init script which call sudo -u some_user -c 'mount /mnt/mountpoint', but is that the only way? I still prefer a single line in /etc/fstab which can mount the gcs bucket as a specified user, e.g. www-data

@eduardcloud
Copy link

eduardcloud commented Apr 25, 2017

Hi, Here I have the same issue, someone can help us?
Regards,
Eduard

@jacobsa
Copy link
Contributor

jacobsa commented Apr 25, 2017

Yes, unless your system supports specifying which user owns the mount helper process in /etc/fstab, you will need to write a script that uses sudo to accomplish this.

@eduardcloud
Copy link

eduardcloud commented Apr 27, 2017

Finally I got it with one line in fstab,

bucket-name /foldername gcsfuse rw,allow_other,uid=33,gid=33,file_mode=0777,dir_mode=0777,key_file=/*******.json

But the performance is.. poor at least, is it normal?

Thank you jacobsa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants