Rclone mount google cloud as linux filesystem

is there a way to mount the google cloud storage as a linux filesystem with their permissions and different owners?

Yes you can see those options here.

https://rclone.org/commands/rclone_mount/#options

rclone v1.55.1
ubuntu 20.04 lts server
google cloud storage

parameters:
RCLONE_DIR_PERMS=0775
RCLONE_FILE_PERMS=0664
RCLONE_UID=1000
RCLONE_GID=1001

command:
rclone mount gcloud:test /gcloud -vv

the problems:

  • the /gcloud is mounted as 1000:1001 (user:group) but when login with the user 1000 or a user in group 1001 and try to list:
    d????????? ? ? ? ? ? gcloud/
    cannot access '/gcloud': Permission denied

  • with the root show it normaly:
    drwxr-xr-x 1 1000 1001 0 Apr 28 04:23 gcloud/

  • the dir and file perms is not respected and mounted as 0755 and 0644

Sounds like you are running it as root I'd imagine.

In Linux any fuse based file system is user based so only the user that mounts it can see.

For other users to use, you need to use --allow-other

1 Like

is there a way to add more users manually to see? because --allow-other with give permissions to all users.

example:
mount with user test and --allow-root. test and root can see.

is there a way to add test2 to see also?

or mount with root and add more users?

The way fuse mount works is you can either set nothing, which allows the user running it only to see or you can use allow-other that does allow everyone else to see or allow root which allows root to use it.

If you use allow-other, everyone can see it and you have to use directory and file permissions to look it down how you see fit.

These two are how you set Linux file permissions on the mount:

      --dir-perms FileMode                     Directory permissions (default 0777)
      --file-perms FileMode                    File permissions (default 0666)

It's worth while to read through a quick tutorial if you aren't familiar with them.

https://ryanstutorials.net/linuxtutorial/permissions.php

You can set the group of the files exported and add users to that group.

  --gid uint32                             Override the gid field set by the filesystem. Not supported on Windows. (default 1000)

So create a group, add the users you want to it and put this ID of the group here.

parameters:
RCLONE_DIR_PERMS=0775
RCLONE_FILE_PERMS=0664
RCLONE_UID=1000
RCLONE_GID=1001

1000=teste
1001=noc

command run as root:
rclone mount gcloud:test /gcloud -vv

so login with the user 1000 or a users with group 1001 and get bellow with ls:
d????????? ? ? ? ? ? gcloud/

when list with root the --dir-perms and --file-perms seens not be respected:
drwxr-xr-x 1 teste noc 0 May 1 17:21 gcloud/

the log show:
2021/05/01 17:23:04 DEBUG : /: >Attr: attr=valid=1h0m0s ino=0 size=0 mode=drwxr-xr-x, err=

You need to use --allow-other to allow someone other than the user running the command.

ok. I did it with the same parameters

rclone mount gcloud:-teste /gcloud -vv --allow-other

so the the --dir-perms and --file-perms seens not be respected:
DEBUG : teste/: >Attr: attr=valid=1h0m0s ino=0 size=0 mode=drwxr-xr-x, err=

drwxr-xr-x instead drwxrwxr-x

and I login with a user teste2 (not owner and not same group) and it can also write.

I'd imagine you are typing something wrong along the way but with no log/details it's super tough to guess.

An example log looks like:

felix@gemini:~$ rclone mount gcrypt: /home/felix/test --dir-perms 775 --file-perms 664 -vv
2021/05/01 13:40:51 DEBUG : Using config file from "/opt/rclone/rclone.conf"
2021/05/01 13:40:51 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "mount" "gcrypt:" "/home/felix/test" "--dir-perms" "775" "--file-perms" "664" "-vv"]
2021/05/01 13:40:51 DEBUG : Creating backend with remote "gcrypt:"
2021/05/01 13:40:51 DEBUG : Creating backend with remote "GD:crypt"
2021/05/01 13:40:52 DEBUG : Encrypted drive 'gcrypt:': Mounting on "/home/felix/test"
2021/05/01 13:40:52 DEBUG : : Root:
-rw-rw-r--  1 felix felix  243 May 19  2019 mounted
felix@gemini:~/test$

ok... doing like you

rclone mount gcloud:animati-teste /gcloud -vv --allow-other --dir-perms 775 --file-perms 664 --umask 0002 --uid 1000 --gid 1001
2021/05/01 17:54:52 DEBUG : Using config file from "/etc/animati/gcloud/rclone.conf"
2021/05/01 17:54:52 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "mount" "gcloud:animati-teste" "/gcloud" "-vv" "--allow-other" "--dir-perms" "775" "--file-perms" "664" "--umask" "0002" "--uid" "1000" "--gid" "1001"]
2021/05/01 17:54:52 DEBUG : Creating backend with remote "gcloud:animati-teste"
2021/05/01 17:54:52 INFO  : GCS bucket animati-teste: poll-interval is not supported by this remote
2021/05/01 17:54:52 DEBUG : GCS bucket animati-teste: Mounting on "/gcloud"
2021/05/01 17:54:52 DEBUG : : Root:

login with user teste2 (1002) and it can write.

how could I block teste2 write?

You'd want to check that out.

there is a problem with rclone, the file permissions are right.

when use --allow-other make no restrictions.

  --default-permissions                    Makes kernel enforce access control based on the file mode. Not supported on Windows.

this seens to solve the problem. what is it the default value?